diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-17 12:18:59 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-17 12:18:59 +0900 |
| commit | 62509edcbe84ec922203aebfe10758a9fa0f61ce (patch) | |
| tree | e620898ed645a5d63eb62d970065c8e75d2031c0 /src/remote/activitypub | |
| parent | Fix #2725 (diff) | |
| download | misskey-62509edcbe84ec922203aebfe10758a9fa0f61ce.tar.gz misskey-62509edcbe84ec922203aebfe10758a9fa0f61ce.tar.bz2 misskey-62509edcbe84ec922203aebfe10758a9fa0f61ce.zip | |
Refactor
Diffstat (limited to 'src/remote/activitypub')
| -rw-r--r-- | src/remote/activitypub/renderer/note.ts | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index 3ed6a6e16a..b3ce1c03e4 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -82,34 +82,38 @@ export default async function renderNote(note: INote, dive = true): Promise<any> const files = await promisedFiles; + let text = note.text; + if (note.poll != null) { - if (note.text == null) note.text = ''; + if (text == null) text = ''; const url = `${config.url}/notes/${note._id}`; // TODO: i18n - note.text += `\n\n[投票を見る](${url})`; + text += `\n\n[投票を見る](${url})`; } if (note.renoteId != null) { - if (note.text == null) note.text = ''; + if (text == null) text = ''; const url = `${config.url}/notes/${note.renoteId}`; - note.text += `\n\nRE: ${url}`; + text += `\n\nRE: ${url}`; } // 省略されたメンションのホストを復元する - const text = note.text ? parseMfm(note.text).map(x => { - if (x.type == 'mention' && x.host == null) { - return `${x.content}@${config.host}`; - } else { - return x.content; - } - }).join('') : null; + if (text != null) { + text = parseMfm(text).map(x => { + if (x.type == 'mention' && x.host == null) { + return `${x.content}@${config.host}`; + } else { + return x.content; + } + }).join(''); + } return { id: `${config.url}/notes/${note._id}`, type: 'Note', attributedTo, summary: note.cw, - content: toHtml(note), + content: toHtml(Object.assign({}, note, { text })), _misskey_content: text, published: note.createdAt.toISOString(), to, |