Skip to content

Commit 02675c0

Browse files
Fix reaction notification (#118)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
1 parent 45c2a10 commit 02675c0

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@hcengineering/communication-server",
5+
"comment": "Remove reaction notification on reaction unset",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@hcengineering/communication-server"
10+
}

packages/server/src/__tests__/notification/notification.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,8 @@ describe('notification', () => {
708708
createdOn: date.getTime()
709709
} as any
710710

711-
const notificationContent: Pick<ReactionNotificationContent, 'emoji' | 'creator'> & { title: string, shortText: string, senderName: string } = {
711+
const notificationContent: ReactionNotificationContent = {
712712
emoji: '👍',
713-
creator: socialId,
714713
title: 'Reacted to your message',
715714
shortText: '👍',
716715
senderName: 'John Doe'
@@ -723,7 +722,8 @@ describe('notification', () => {
723722
messageId,
724723
account: accountUuid,
725724
created: date,
726-
content: notificationContent
725+
content: notificationContent,
726+
creator: socialId
727727
}
728728

729729
const context: NotificationContext = {
@@ -801,9 +801,8 @@ describe('notification', () => {
801801
createdOn: date.getTime()
802802
} as any
803803

804-
const notificationContent: Pick<ReactionNotificationContent, 'emoji' | 'creator'> & { title: string, shortText: string, senderName: string } = {
804+
const notificationContent: ReactionNotificationContent = {
805805
emoji: '👍',
806-
creator: socialId,
807806
title: 'Reacted to your message',
808807
shortText: '👍',
809808
senderName: 'John Doe'
@@ -816,7 +815,8 @@ describe('notification', () => {
816815
messageId,
817816
account: accountUuid,
818817
created: date,
819-
content: notificationContent
818+
content: notificationContent,
819+
creator: socialId
820820
}
821821

822822
const olderNotification = {

packages/server/src/notification/notification.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ async function removeReactionNotification (
101101
ctx: ctx.ctx,
102102
account: ctx.account
103103
},
104-
meta.creator,
105-
true
104+
meta.creator
106105
)) as AccountUuid | undefined
107106
if (messageAccount == null) return result
108107

@@ -114,7 +113,7 @@ async function removeReactionNotification (
114113

115114
const toDelete = notifications.find((n) => {
116115
const content = n.content as ReactionNotificationContent
117-
return content.emoji === reaction && content.creator === socialId
116+
return content.emoji === reaction && n.creator === socialId
118117
})
119118

120119
if (toDelete === undefined) return result

0 commit comments

Comments
 (0)