From aecc21890eb6c9134ff04c0150d03d7ea637de38 Mon Sep 17 00:00:00 2001 From: Kapil Jain Date: Tue, 29 Oct 2019 14:20:51 -0400 Subject: [PATCH] fixed removing original post's user --- .../notifications/notificationsMiddleware.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/backend/src/middleware/notifications/notificationsMiddleware.js b/backend/src/middleware/notifications/notificationsMiddleware.js index ff1f50c59..2b3f1c2dd 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.js @@ -106,15 +106,13 @@ const handleContentDataOfComment = async (resolve, root, args, context, resolveI const [postAuthor] = await result.records.map(record => { return record.get('user') }) - const idsOfUsersExcludingPostAuthor = idsOfUsers.filter(res => !res.equals([postAuthor])) - cosole.log('idsOfUsers1') - await notifyUsers( - 'Comment', - comment.id, - idsOfUsersExcludingPostAuthor, - 'mentioned_in_comment', - context, - ) + var index = idsOfUsers.indexOf(postAuthor.id) + + if (index > -1) { + idsOfUsers.splice(index) + } + + await notifyUsers('Comment', comment.id, idsOfUsers, 'mentioned_in_comment', context) } return comment