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> {
|
export default class CommentUpdatedNotificationsTask extends BaseTask<CommentEvent> {
|
||||||
public async perform(event: CommentUpdateEvent) {
|
public async perform(event: CommentUpdateEvent) {
|
||||||
|
const newMentionIds = event.data.newMentionIds;
|
||||||
|
if (!newMentionIds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const [document, comment] = await Promise.all([
|
const [document, comment] = await Promise.all([
|
||||||
Document.scope("withCollection").findOne({
|
Document.scope("withCollection").findOne({
|
||||||
where: {
|
where: {
|
||||||
@@ -20,7 +25,7 @@ export default class CommentUpdatedNotificationsTask extends BaseTask<CommentEve
|
|||||||
|
|
||||||
const mentions = ProsemirrorHelper.parseMentions(
|
const mentions = ProsemirrorHelper.parseMentions(
|
||||||
ProsemirrorHelper.toProsemirror(comment.data)
|
ProsemirrorHelper.toProsemirror(comment.data)
|
||||||
).filter((mention) => event.data.newMentionIds.includes(mention.id));
|
).filter((mention) => newMentionIds.includes(mention.id));
|
||||||
const userIdsMentioned: string[] = [];
|
const userIdsMentioned: string[] = [];
|
||||||
|
|
||||||
for (const mention of mentions) {
|
for (const mention of mentions) {
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ export type CommentUpdateEvent = BaseEvent<Comment> & {
|
|||||||
documentId: string;
|
documentId: string;
|
||||||
actorId: string;
|
actorId: string;
|
||||||
data: {
|
data: {
|
||||||
newMentionIds: string[];
|
newMentionIds?: string[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user