From 2fdf516ede28189e4fe918e6f58af990ee4d8b39 Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Fri, 21 Nov 2025 13:30:09 +0700 Subject: [PATCH 1/3] Fix duplicated inbox app Signed-off-by: Artem Savchenko --- models/inbox/src/index.ts | 2 +- .../src/components/Workbench.svelte | 71 +++++++++++++------ 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/models/inbox/src/index.ts b/models/inbox/src/index.ts index bde12f03ac6..abe9bbbfc9d 100644 --- a/models/inbox/src/index.ts +++ b/models/inbox/src/index.ts @@ -32,7 +32,7 @@ export function createModel (builder: Builder): void { label: inbox.string.Inbox, icon: inbox.icon.Inbox, alias: inboxId, - hidden: false, + hidden: true, component: inbox.component.InboxApplication, position: 'top', order: 100 diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 380156d6b90..10450e5bbf9 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -29,11 +29,13 @@ import login, { loginId } from '@hcengineering/login' import notification, { DocNotifyContext, InboxNotification, notificationId } from '@hcengineering/notification' import { BrowserNotificatator, InboxNotificationsClientImpl } from '@hcengineering/notification-resources' + import inbox, { inboxId } from '@hcengineering/inbox' import { broadcastEvent, getMetadata, getResource, IntlString, translate } from '@hcengineering/platform' import { ActionContext, ComponentExtensions, createQuery, + createNotificationsQuery, getClient, isAdminUser, reduceCalls @@ -282,6 +284,13 @@ hasInboxNotifications = res }) + let hasNewInboxNotifications = false + const notificationCountQuery = createNotificationsQuery() + + notificationCountQuery.query({ read: false, limit: 1 }, (res) => { + hasNewInboxNotifications = res.getResult().length > 0 + }) + const doSyncLoc = reduceCalls(async (loc: Location): Promise => { if (workspaceId !== $location.path[1]) { tabs = [] @@ -759,15 +768,17 @@ let inboxPopup: PopupResult | undefined = undefined let lastLoc: Location | undefined = undefined + $: activeInboxId = isCommunicationEnabled ? inboxId : notificationId + $: inboxProps = { - selected: currentAppAlias === notificationId || inboxPopup !== undefined, - navigator: (currentAppAlias === notificationId || inboxPopup !== undefined) && $deviceInfo.navigator.visible, - notify: hasInboxNotifications, + selected: currentAppAlias === activeInboxId || inboxPopup !== undefined, + navigator: (currentAppAlias === activeInboxId || inboxPopup !== undefined) && $deviceInfo.navigator.visible, + notify: isCommunicationEnabled ? (hasInboxNotifications || hasNewInboxNotifications) : hasInboxNotifications, onClick: (e: MouseEvent) => { if (e.metaKey || e.ctrlKey) return - if (!$deviceInfo.navigator.visible && $deviceInfo.navigator.float && currentAppAlias === notificationId) { + if (!$deviceInfo.navigator.visible && $deviceInfo.navigator.float && currentAppAlias === activeInboxId) { toggleNav() - } else if (currentAppAlias === notificationId && lastLoc !== undefined) { + } else if (currentAppAlias === activeInboxId && lastLoc !== undefined) { e.preventDefault() e.stopPropagation() navigate(lastLoc) @@ -778,7 +789,7 @@ } } - $: customAppProps = new Map([[notificationId, inboxProps]]) + $: customAppProps = new Map([[notificationId, inboxProps], [inboxId, inboxProps]]) defineSeparators('workbench', workbenchSeparators) defineSeparators('main', mainSeparators) @@ -859,22 +870,38 @@ on:click={toggleNav} /> - - {#if !isExcludedApp(notificationId) && !isCommunicationEnabled} - - - + {#if !isExcludedApp(activeInboxId)} + {#if !isCommunicationEnabled} + + + + {:else} + + + + {/if} {/if} Date: Fri, 21 Nov 2025 13:43:06 +0700 Subject: [PATCH 2/3] Update plugins/workbench-resources/src/components/Workbench.svelte Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Artyom Savchenko --- .../src/components/Workbench.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 10450e5bbf9..849fd04fddd 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -285,11 +285,15 @@ }) let hasNewInboxNotifications = false - const notificationCountQuery = createNotificationsQuery() - notificationCountQuery.query({ read: false, limit: 1 }, (res) => { - hasNewInboxNotifications = res.getResult().length > 0 - }) + $: if (isCommunicationEnabled) { + const notificationCountQuery = createNotificationsQuery() + notificationCountQuery.query({ read: false, limit: 1 }, (res) => { + hasNewInboxNotifications = res.getResult().length > 0 + }) + } else { + hasNewInboxNotifications = false + } const doSyncLoc = reduceCalls(async (loc: Location): Promise => { if (workspaceId !== $location.path[1]) { From 17f92b9b679754ea40619f4ece29bb800de0c446 Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Fri, 21 Nov 2025 13:46:25 +0700 Subject: [PATCH 3/3] Fix formatting Signed-off-by: Artem Savchenko --- .../src/components/Workbench.svelte | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 849fd04fddd..8b19761eb36 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -777,7 +777,7 @@ $: inboxProps = { selected: currentAppAlias === activeInboxId || inboxPopup !== undefined, navigator: (currentAppAlias === activeInboxId || inboxPopup !== undefined) && $deviceInfo.navigator.visible, - notify: isCommunicationEnabled ? (hasInboxNotifications || hasNewInboxNotifications) : hasInboxNotifications, + notify: isCommunicationEnabled ? hasInboxNotifications || hasNewInboxNotifications : hasInboxNotifications, onClick: (e: MouseEvent) => { if (e.metaKey || e.ctrlKey) return if (!$deviceInfo.navigator.visible && $deviceInfo.navigator.float && currentAppAlias === activeInboxId) { @@ -793,7 +793,10 @@ } } - $: customAppProps = new Map([[notificationId, inboxProps], [inboxId, inboxProps]]) + $: customAppProps = new Map([ + [notificationId, inboxProps], + [inboxId, inboxProps] + ]) defineSeparators('workbench', workbenchSeparators) defineSeparators('main', mainSeparators) @@ -894,9 +897,7 @@