diff options
| author | Amelia Yukii <amelia.yukii@shourai.de> | 2024-02-15 22:18:58 +0000 |
|---|---|---|
| committer | Amelia Yukii <amelia.yukii@shourai.de> | 2024-02-15 22:18:58 +0000 |
| commit | be36a793cd4e2e779a069f4f531d1789cdfbc0cf (patch) | |
| tree | ec6da226ed7c93d3d7c281992d87b5a56dc42d14 /packages/backend/src/core | |
| parent | merge: Never return broken notifications #409 (!415) (diff) | |
| parent | avoid parsing undefined (diff) | |
| download | sharkey-be36a793cd4e2e779a069f4f531d1789cdfbc0cf.tar.gz sharkey-be36a793cd4e2e779a069f4f531d1789cdfbc0cf.tar.bz2 sharkey-be36a793cd4e2e779a069f4f531d1789cdfbc0cf.zip | |
merge: Fix Note Edits being federated incorrectly (!417)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/417
Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
Approved-by: dakkar <dakkar@thenautilus.net>
Diffstat (limited to 'packages/backend/src/core')
| -rw-r--r-- | packages/backend/src/core/activitypub/ApMfmService.ts | 2 | ||||
| -rw-r--r-- | packages/backend/src/core/activitypub/ApRendererService.ts | 23 |
2 files changed, 11 insertions, 14 deletions
diff --git a/packages/backend/src/core/activitypub/ApMfmService.ts b/packages/backend/src/core/activitypub/ApMfmService.ts index 0716e43123..88f0da281f 100644 --- a/packages/backend/src/core/activitypub/ApMfmService.ts +++ b/packages/backend/src/core/activitypub/ApMfmService.ts @@ -35,7 +35,7 @@ export class ApMfmService { noMisskeyContent = true; } - const content = this.mfmService.toHtml(parsed, JSON.parse(note.mentionedRemoteUsers)); + const content = this.mfmService.toHtml(parsed, note.mentionedRemoteUsers ? JSON.parse(note.mentionedRemoteUsers) : []); return { content, diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index e07bb8be78..f9376624db 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -700,17 +700,15 @@ export class ApRendererService { poll = await this.pollsRepository.findOneBy({ noteId: note.id }); } - let apText = text; + let apAppend = ''; if (quote) { - apText += `\n\nRE: ${quote}`; + apAppend += `\n\nRE: ${quote}`; } const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw; - const content = this.apMfmService.getNoteHtml(Object.assign({}, note, { - text: apText, - })); + const { content, noMisskeyContent } = this.apMfmService.getNoteHtml(note, apAppend); const emojis = await this.getEmojis(note.emojis); const apemojis = emojis.filter(emoji => !emoji.localOnly).map(emoji => this.renderEmoji(emoji)); @@ -723,9 +721,6 @@ export class ApRendererService { const asPoll = poll ? { type: 'Question', - content: this.apMfmService.getNoteHtml(Object.assign({}, note, { - text: text, - })), [poll.expiresAt && poll.expiresAt < new Date() ? 'closed' : 'endTime']: poll.expiresAt, [poll.multiple ? 'anyOf' : 'oneOf']: poll.choices.map((text, i) => ({ type: 'Note', @@ -744,11 +739,13 @@ export class ApRendererService { summary: summary ?? undefined, content: content ?? undefined, updated: note.updatedAt?.toISOString(), - _misskey_content: text, - source: { - content: text, - mediaType: 'text/x.misskeymarkdown', - }, + ...(noMisskeyContent ? {} : { + _misskey_content: text, + source: { + content: text, + mediaType: 'text/x.misskeymarkdown', + }, + }), _misskey_quote: quote, quoteUrl: quote, quoteUri: quote, |