From ed3e8c0b6bd9ddf03550e01dfecc693fb1b5d38e Mon Sep 17 00:00:00 2001 From: Kristina Date: Thu, 24 Jul 2025 21:11:47 +0400 Subject: [PATCH] Improve notifications count (#9598) * Update communication Signed-off-by: Kristina Fefelova * Show real unread notifications count Signed-off-by: Kristina Fefelova * Small ui changes Signed-off-by: Kristina Fefelova --------- Signed-off-by: Kristina Fefelova --- communication | 2 +- desktop/src/ui/notifications.ts | 4 +- packages/presentation/src/communication.ts | 7 ++-- .../navigator-next/NavigatorCard.svelte | 20 ++++------ .../navigator-next/NavigatorCards.svelte | 3 +- .../NavigatorCardsSection.svelte | 3 +- plugins/communication-assets/lang/cs.json | 3 +- plugins/communication-assets/lang/de.json | 3 +- plugins/communication-assets/lang/en.json | 3 +- plugins/communication-assets/lang/es.json | 3 +- plugins/communication-assets/lang/fr.json | 3 +- plugins/communication-assets/lang/it.json | 3 +- plugins/communication-assets/lang/ja.json | 3 +- plugins/communication-assets/lang/pt.json | 3 +- plugins/communication-assets/lang/ru.json | 3 +- plugins/communication-assets/lang/zh.json | 3 +- .../src/components/MessagesList.svelte | 15 ++++++++ .../poll/PollOptionPresenter.svelte | 25 ++++++++----- .../src/components/poll/PollPresenter.svelte | 17 ++++++++- .../poll/UserVoteActivityPresenter.svelte | 22 ++++++----- plugins/communication/src/index.ts | 3 +- .../src/components/InboxCard.svelte | 17 ++++++--- .../src/components/InboxCardIcon.svelte | 5 ++- .../src/components/InboxNavigation.svelte | 2 +- .../src/components/NotifyMarker.svelte | 19 ++++------ server/rpc/src/rpc.ts | 37 +++++++++++++++++-- 26 files changed, 154 insertions(+), 77 deletions(-) diff --git a/communication b/communication index ffed29fc6b..90b0ea297d 160000 --- a/communication +++ b/communication @@ -1 +1 @@ -Subproject commit ffed29fc6bbdf7e7d766ee902f3c5a7089098d5a +Subproject commit 90b0ea297d2c4c2ab3569bff69721beec6809932 diff --git a/desktop/src/ui/notifications.ts b/desktop/src/ui/notifications.ts index 9062ba31be..2d4a988b6f 100644 --- a/desktop/src/ui/notifications.ts +++ b/desktop/src/ui/notifications.ts @@ -134,8 +134,8 @@ export function configureNotifications (): void { const isCommunicationEnabled = getMetadata(communication.metadata.Enabled) ?? false if (isCommunicationEnabled) { - notificationsCountQuery.query({ read: false, limit: 1000 }, res => { - newUnreadNotifications = res.getResult().length + notificationsCountQuery.query({ read: false, limit: 1, strict: true, total: true }, res => { + newUnreadNotifications = res.getTotal() if (preferences.showUnreadCounter) { electronAPI.setBadge(prevUnViewdNotificationsCount + newUnreadNotifications) diff --git a/packages/presentation/src/communication.ts b/packages/presentation/src/communication.ts index b570a3efe0..7a4f1424ae 100644 --- a/packages/presentation/src/communication.ts +++ b/packages/presentation/src/communication.ts @@ -60,7 +60,8 @@ import { type AttachmentID, type AttachmentData, type AttachmentParams, - type AttachmentUpdateData + type AttachmentUpdateData, + type WithTotal } from '@hcengineering/communication-types' import core, { generateId, @@ -368,9 +369,9 @@ class Client { ).value } - async findNotifications (params: FindNotificationsParams, queryId?: number): Promise { + async findNotifications (params: FindNotificationsParams, queryId?: number): Promise> { return ( - await this.connection.domainRequest(COMMUNICATION, { + await this.connection.domainRequest>(COMMUNICATION, { findNotifications: { params, queryId } }) ).value diff --git a/plugins/card-resources/src/components/navigator-next/NavigatorCard.svelte b/plugins/card-resources/src/components/navigator-next/NavigatorCard.svelte index abebd5d9ee..5fe7997f8d 100644 --- a/plugins/card-resources/src/components/navigator-next/NavigatorCard.svelte +++ b/plugins/card-resources/src/components/navigator-next/NavigatorCard.svelte @@ -15,7 +15,7 @@ - -{#if addedVote} - + + + {#if addedVote} -{:else} - + {voteLabel} + {:else} -{/if} + {/if} +