diff --git a/common/changes/@hcengineering/communication-server/fix-reaction-notification_2025-10-22-12-46.json b/common/changes/@hcengineering/communication-server/fix-reaction-notification_2025-10-22-12-46.json new file mode 100644 index 0000000..1b935d6 --- /dev/null +++ b/common/changes/@hcengineering/communication-server/fix-reaction-notification_2025-10-22-12-46.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@hcengineering/communication-server", + "comment": "Remove reaction notification on reaction unset", + "type": "patch" + } + ], + "packageName": "@hcengineering/communication-server" +} \ No newline at end of file diff --git a/packages/server/src/__tests__/notification/notification.test.ts b/packages/server/src/__tests__/notification/notification.test.ts index cbe626c..9431cb8 100644 --- a/packages/server/src/__tests__/notification/notification.test.ts +++ b/packages/server/src/__tests__/notification/notification.test.ts @@ -708,9 +708,8 @@ describe('notification', () => { createdOn: date.getTime() } as any - const notificationContent: Pick & { title: string, shortText: string, senderName: string } = { + const notificationContent: ReactionNotificationContent = { emoji: '👍', - creator: socialId, title: 'Reacted to your message', shortText: '👍', senderName: 'John Doe' @@ -723,7 +722,8 @@ describe('notification', () => { messageId, account: accountUuid, created: date, - content: notificationContent + content: notificationContent, + creator: socialId } const context: NotificationContext = { @@ -801,9 +801,8 @@ describe('notification', () => { createdOn: date.getTime() } as any - const notificationContent: Pick & { title: string, shortText: string, senderName: string } = { + const notificationContent: ReactionNotificationContent = { emoji: '👍', - creator: socialId, title: 'Reacted to your message', shortText: '👍', senderName: 'John Doe' @@ -816,7 +815,8 @@ describe('notification', () => { messageId, account: accountUuid, created: date, - content: notificationContent + content: notificationContent, + creator: socialId } const olderNotification = { diff --git a/packages/server/src/notification/notification.ts b/packages/server/src/notification/notification.ts index 99f7daf..bfa83d1 100644 --- a/packages/server/src/notification/notification.ts +++ b/packages/server/src/notification/notification.ts @@ -101,8 +101,7 @@ async function removeReactionNotification ( ctx: ctx.ctx, account: ctx.account }, - meta.creator, - true + meta.creator )) as AccountUuid | undefined if (messageAccount == null) return result @@ -114,7 +113,7 @@ async function removeReactionNotification ( const toDelete = notifications.find((n) => { const content = n.content as ReactionNotificationContent - return content.emoji === reaction && content.creator === socialId + return content.emoji === reaction && n.creator === socialId }) if (toDelete === undefined) return result