From c7179bbe515c3ee05061bf889233412ac5e137e2 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 12 Feb 2026 17:17:25 +0100 Subject: [PATCH 1/2] 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 --- .../src/actions/inlineUnreadCommentsAction.ts | 9 ++++++++- apps/comments/src/files-sidebar.ts | 6 +++--- apps/comments/src/utils/activity.ts | 13 +++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 apps/comments/src/utils/activity.ts diff --git a/apps/comments/src/actions/inlineUnreadCommentsAction.ts b/apps/comments/src/actions/inlineUnreadCommentsAction.ts index 1ffdbeafc2ab7..4f77a66244c2c 100644 --- a/apps/comments/src/actions/inlineUnreadCommentsAction.ts +++ b/apps/comments/src/actions/inlineUnreadCommentsAction.ts @@ -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 }) diff --git a/apps/comments/src/files-sidebar.ts b/apps/comments/src/files-sidebar.ts index 47ff8dfc1cba9..1a39291c48d42 100644 --- a/apps/comments/src/files-sidebar.ts +++ b/apps/comments/src/files-sidebar.ts @@ -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() diff --git a/apps/comments/src/utils/activity.ts b/apps/comments/src/utils/activity.ts new file mode 100644 index 0000000000000..3a3063be20aab --- /dev/null +++ b/apps/comments/src/utils/activity.ts @@ -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 +} From af9aeef8ffdaf7538f79c6a1436a24a2383b1a57 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 12 Feb 2026 17:20:30 +0100 Subject: [PATCH 2/2] fix(files): fallback to action id if displayname is empty This fixes invalid error messages if the action has an empty displayname, often the case for inline actions Signed-off-by: Ferdinand Thiessen --- apps/files/src/utils/actionUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/src/utils/actionUtils.ts b/apps/files/src/utils/actionUtils.ts index 5a752d6258752..e72cdbc3ba112 100644 --- a/apps/files/src/utils/actionUtils.ts +++ b/apps/files/src/utils/actionUtils.ts @@ -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 }) }