From 0a74937a745a168be7ce6f3bb1446db8f854a0e0 Mon Sep 17 00:00:00 2001 From: Kristina Date: Thu, 29 Feb 2024 10:32:09 +0400 Subject: [PATCH] UBER-1239: fix missing notifications for mentions from doc (#4820) Signed-off-by: Kristina Fefelova Signed-off-by: Tiago Cruz --- server-plugins/notification-resources/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index 46eac8355f..27eefa2c8e 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -609,6 +609,15 @@ export async function createCollabDocInfo ( } const targets = new Set(collaborators) + + // user is not collaborator of himself, but we should notify user of changes related to users account (mentions, comments etc) + if (control.hierarchy.isDerived(object._class, contact.class.Person)) { + const acc = await getPersonAccount(object._id as Ref, control) + if (acc !== undefined) { + targets.add(acc._id) + } + } + const notifyContexts = await control.findAll(notification.class.DocNotifyContext, { attachedTo: { $in: activityMessage.map(({ attachedTo }) => attachedTo) } })