mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(comments): properly handle opening the sidebar when Activity integration is used
When the activity integration is used we need to open the `activity` tab not the comments tab. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
b80816dfb7
commit
cd15bb0679
3 changed files with 24 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import CommentProcessingSvg from '@mdi/svg/svg/comment-processing.svg?raw'
|
|||
import { getSidebar } from '@nextcloud/files'
|
||||
import { n, t } from '@nextcloud/l10n'
|
||||
import logger from '../logger.js'
|
||||
import { isUsingActivityIntegration } from '../utils/activity.js'
|
||||
|
||||
export const action: IFileAction = {
|
||||
id: 'comments-unread',
|
||||
|
|
@ -38,7 +39,13 @@ export const action: IFileAction = {
|
|||
|
||||
try {
|
||||
const sidebar = getSidebar()
|
||||
sidebar.open(nodes[0], 'comments')
|
||||
const sidebarTabId = isUsingActivityIntegration() ? 'activity' : 'comments'
|
||||
if (sidebar.isOpen && sidebar.node?.source === nodes[0].source) {
|
||||
logger.debug('Sidebar already open for this node, just activating comments tab')
|
||||
sidebar.setActiveTab(sidebarTabId)
|
||||
return null
|
||||
}
|
||||
sidebar.open(nodes[0], sidebarTabId)
|
||||
return null
|
||||
} catch (error) {
|
||||
logger.error('Error while opening sidebar', { error })
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*!
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
|
@ -6,18 +6,18 @@
|
|||
import MessageReplyText from '@mdi/svg/svg/message-reply-text.svg?raw'
|
||||
import { getCSPNonce } from '@nextcloud/auth'
|
||||
import { registerSidebarTab } from '@nextcloud/files'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import wrap from '@vue/web-component-wrapper'
|
||||
import { createPinia, PiniaVuePlugin } from 'pinia'
|
||||
import Vue from 'vue'
|
||||
import { registerCommentsPlugins } from './comments-activity-tab.ts'
|
||||
import { isUsingActivityIntegration } from './utils/activity.ts'
|
||||
|
||||
__webpack_nonce__ = getCSPNonce()
|
||||
|
||||
const tagName = 'comments_files-sidebar-tab'
|
||||
|
||||
if (loadState('comments', 'activityEnabled', false) && OCA?.Activity?.registerSidebarAction !== undefined) {
|
||||
if (isUsingActivityIntegration()) {
|
||||
// Do not mount own tab but mount into activity
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
registerCommentsPlugins()
|
||||
|
|
|
|||
13
apps/comments/src/utils/activity.ts
Normal file
13
apps/comments/src/utils/activity.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*!
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
|
||||
/**
|
||||
* Check if the comments app is using the Activity app integration for the sidebar.
|
||||
*/
|
||||
export function isUsingActivityIntegration() {
|
||||
return loadState('comments', 'activityEnabled', false) && window.OCA?.Activity?.registerSidebarAction !== undefined
|
||||
}
|
||||
Loading…
Reference in a new issue