Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@hcengineering/communication-server",
"comment": "Remove reaction notification on reaction unset",
"type": "patch"
}
],
"packageName": "@hcengineering/communication-server"
}
12 changes: 6 additions & 6 deletions packages/server/src/__tests__/notification/notification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,8 @@ describe('notification', () => {
createdOn: date.getTime()
} as any

const notificationContent: Pick<ReactionNotificationContent, 'emoji' | 'creator'> & { title: string, shortText: string, senderName: string } = {
const notificationContent: ReactionNotificationContent = {
emoji: '👍',
creator: socialId,
title: 'Reacted to your message',
shortText: '👍',
senderName: 'John Doe'
Expand All @@ -723,7 +722,8 @@ describe('notification', () => {
messageId,
account: accountUuid,
created: date,
content: notificationContent
content: notificationContent,
creator: socialId
}

const context: NotificationContext = {
Expand Down Expand Up @@ -801,9 +801,8 @@ describe('notification', () => {
createdOn: date.getTime()
} as any

const notificationContent: Pick<ReactionNotificationContent, 'emoji' | 'creator'> & { title: string, shortText: string, senderName: string } = {
const notificationContent: ReactionNotificationContent = {
emoji: '👍',
creator: socialId,
title: 'Reacted to your message',
shortText: '👍',
senderName: 'John Doe'
Expand All @@ -816,7 +815,8 @@ describe('notification', () => {
messageId,
account: accountUuid,
created: date,
content: notificationContent
content: notificationContent,
creator: socialId
}

const olderNotification = {
Expand Down
5 changes: 2 additions & 3 deletions packages/server/src/notification/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down