diff options
Diffstat (limited to 'src/remote/activitypub/misc/get-note-html.ts')
| -rw-r--r-- | src/remote/activitypub/misc/get-note-html.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/remote/activitypub/misc/get-note-html.ts b/src/remote/activitypub/misc/get-note-html.ts new file mode 100644 index 0000000000..5bca4eed62 --- /dev/null +++ b/src/remote/activitypub/misc/get-note-html.ts @@ -0,0 +1,23 @@ +import { INote } from "../../../models/note"; +import toHtml from '../../../text/html'; +import parse from '../../../text/parse'; +import config from '../../../config'; + +export default function(note: INote) { + if (note.text == null) return null; + + let html = toHtml(parse(note.text)); + + if (note.poll != null) { + const url = `${config.url}/notes/${note._id}`; + // TODO: i18n + html += `<p><a href="${url}">【Misskeyで投票を見る】</a></p>`; + } + + if (note.renoteId != null) { + const url = `${config.url}/notes/${note.renoteId}`; + html += `<p>RE: <a href="${url}">${url}</a></p>`; + } + + return html; +} |