From b21b33831ad2584c832537b1819f6151bf5c37e5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 17 Sep 2018 03:36:58 +0900 Subject: [PATCH] Fix bug --- src/remote/activitypub/renderer/note.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index 33400ad440..5d28e5f450 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -6,6 +6,7 @@ import DriveFile, { IDriveFile } from '../../../models/drive-file'; import Note, { INote } from '../../../models/note'; import User from '../../../models/user'; import toHtml from '../misc/get-note-html'; +import parseMfm from '../../../mfm/parse'; export default async function renderNote(note: INote, dive = true): Promise { const promisedFiles: Promise = note.fileIds @@ -81,13 +82,21 @@ export default async function renderNote(note: INote, dive = true): Promise const files = await promisedFiles; + 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; + return { id: `${config.url}/notes/${note._id}`, type: 'Note', attributedTo, summary: note.cw, content: toHtml(note), - _misskey_content: note.text, + _misskey_content: text, published: note.createdAt.toISOString(), to, cc,