Merge pull request #58287 from nextcloud/fix/comments-action

fix(comments): properly handle opening the sidebar when Activity integration is used
This commit is contained in:
Ferdinand Thiessen 2026-02-12 19:10:58 +01:00 committed by GitHub
commit 202124cd28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 37 additions and 17 deletions

View file

@ -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 })

View file

@ -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()

View 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
}

View file

@ -48,7 +48,7 @@ export async function executeAction(action: IFileAction) {
let displayName = action.id
try {
displayName = action.displayName(context)
displayName = action.displayName(context) || displayName
} catch (error) {
logger.error('Error while getting action display name', { action, error })
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long