Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/comments/src/actions/inlineUnreadCommentsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 })
Expand Down
6 changes: 3 additions & 3 deletions apps/comments/src/files-sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/**
/*!
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

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()
Expand Down
13 changes: 13 additions & 0 deletions apps/comments/src/utils/activity.ts
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion apps/files/src/utils/actionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down
Loading