fix: newMentionIds no longer always in event data, closes #7186
This commit is contained in:
@@ -6,6 +6,11 @@ import BaseTask, { TaskPriority } from "./BaseTask";
|
||||
|
||||
export default class CommentUpdatedNotificationsTask extends BaseTask<CommentEvent> {
|
||||
public async perform(event: CommentUpdateEvent) {
|
||||
const newMentionIds = event.data.newMentionIds;
|
||||
if (!newMentionIds) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [document, comment] = await Promise.all([
|
||||
Document.scope("withCollection").findOne({
|
||||
where: {
|
||||
@@ -20,7 +25,7 @@ export default class CommentUpdatedNotificationsTask extends BaseTask<CommentEve
|
||||
|
||||
const mentions = ProsemirrorHelper.parseMentions(
|
||||
ProsemirrorHelper.toProsemirror(comment.data)
|
||||
).filter((mention) => event.data.newMentionIds.includes(mention.id));
|
||||
).filter((mention) => newMentionIds.includes(mention.id));
|
||||
const userIdsMentioned: string[] = [];
|
||||
|
||||
for (const mention of mentions) {
|
||||
|
||||
@@ -342,7 +342,7 @@ export type CommentUpdateEvent = BaseEvent<Comment> & {
|
||||
documentId: string;
|
||||
actorId: string;
|
||||
data: {
|
||||
newMentionIds: string[];
|
||||
newMentionIds?: string[];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user