diff --git a/packages/backend/src/core/activitypub/ApMfmService.ts b/packages/backend/src/core/activitypub/ApMfmService.ts index 60868627a..c45c27f86 100644 --- a/packages/backend/src/core/activitypub/ApMfmService.ts +++ b/packages/backend/src/core/activitypub/ApMfmService.ts @@ -27,6 +27,6 @@ export class ApMfmService { @bindThis public getNoteHtml(note: MiNote): string | null { if (!note.text) return ''; - return this.mfmService.toHtml(mfm.parse(note.text), JSON.parse(note.mentionedRemoteUsers)); + return this.mfmService.toHtml(mfm.parse(note.text), note.mentionedRemoteUsers ? JSON.parse(note.mentionedRemoteUsers) : []); } } diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index 7a9d2e21d..b772f3efd 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -353,7 +353,7 @@ export class ApRendererService { const attributedTo = this.userEntityService.genLocalUserUri(note.userId); - const mentions = (JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers).map(x => x.uri); + const mentions = note.mentionedRemoteUsers ? (JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers).map(x => x.uri) : []; let to: string[] = []; let cc: string[] = []; @@ -371,7 +371,7 @@ export class ApRendererService { to = mentions; } - const mentionedUsers = note.mentions.length > 0 ? await this.usersRepository.findBy({ + const mentionedUsers = note.mentions && note.mentions.length > 0 ? await this.usersRepository.findBy({ id: In(note.mentions), }) : [];