fix: newMentionIds no longer always in event data, closes #7186

This commit is contained in:
Tom Moor
2024-07-02 18:03:22 -04:00
parent a8d4a5b587
commit 8a8dad15ef
2 changed files with 7 additions and 2 deletions

View File

@@ -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) {

View File

@@ -342,7 +342,7 @@ export type CommentUpdateEvent = BaseEvent<Comment> & {
documentId: string;
actorId: string;
data: {
newMentionIds: string[];
newMentionIds?: string[];
};
};