fix: Duplicate mentions results in duplicate notifications (#5585)
This commit is contained in:
@@ -40,6 +40,10 @@ export default class CommentCreatedNotificationsTask extends BaseTask<CommentEve
|
||||
const userIdsMentioned: string[] = [];
|
||||
|
||||
for (const mention of mentions) {
|
||||
if (userIdsMentioned.includes(mention.modelId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const recipient = await User.findByPk(mention.modelId);
|
||||
|
||||
if (
|
||||
|
||||
@@ -21,11 +21,13 @@ export default class CommentUpdatedNotificationsTask extends BaseTask<CommentEve
|
||||
const mentions = ProsemirrorHelper.parseMentions(
|
||||
ProsemirrorHelper.toProsemirror(comment.data)
|
||||
).filter((mention) => event.data.newMentionIds.includes(mention.id));
|
||||
if (mentions.length === 0) {
|
||||
return;
|
||||
}
|
||||
const userIdsMentioned: string[] = [];
|
||||
|
||||
for (const mention of mentions) {
|
||||
if (userIdsMentioned.includes(mention.modelId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const recipient = await User.findByPk(mention.modelId);
|
||||
|
||||
if (
|
||||
|
||||
@@ -22,6 +22,10 @@ export default class DocumentPublishedNotificationsTask extends BaseTask<Documen
|
||||
const userIdsMentioned: string[] = [];
|
||||
|
||||
for (const mention of mentions) {
|
||||
if (userIdsMentioned.includes(mention.modelId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const recipient = await User.findByPk(mention.modelId);
|
||||
|
||||
if (
|
||||
|
||||
@@ -32,6 +32,10 @@ export default class RevisionCreatedNotificationsTask extends BaseTask<RevisionE
|
||||
const userIdsMentioned: string[] = [];
|
||||
|
||||
for (const mention of mentions) {
|
||||
if (userIdsMentioned.includes(mention.modelId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const recipient = await User.findByPk(mention.modelId);
|
||||
if (
|
||||
recipient &&
|
||||
|
||||
Reference in New Issue
Block a user