From f2b1cf92e1ab683c680d5da4ccd55733d8feff56 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sat, 1 Dec 2018 07:15:10 +0900 Subject: [PATCH] AP CW (#3448) --- src/remote/activitypub/models/note.ts | 4 +++- src/remote/activitypub/renderer/note.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 0f0f0bc2b..9fc03c777 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -103,6 +103,8 @@ export async function createNote(value: any, resolver?: Resolver, silent = false quote = await resolveNote(note._misskey_quote).catch(() => null); } + const cw = note.summary === '' ? null : note.summary; + // テキストのパース const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content); @@ -120,7 +122,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false files: files, reply, renote: quote, - cw: note.summary, + cw: cw, text: text, viaMobile: false, localOnly: false, diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index a854ad9f1..76a527e9a 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -106,6 +106,8 @@ export default async function renderNote(note: INote, dive = true): Promise text += `\n\nRE: ${url}`; } + const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw; + const content = toHtml(Object.assign({}, note, { text })); const emojis = await getEmojis(note.emojis); @@ -121,7 +123,7 @@ export default async function renderNote(note: INote, dive = true): Promise id: `${config.url}/notes/${note._id}`, type: 'Note', attributedTo, - summary: note.cw, + summary, content, _misskey_content: text, _misskey_quote: quote,