From 20e77196f28178c869402985761bd4c2fa74bf0a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 22 Apr 2018 10:44:17 +0900 Subject: AP: 投票をレンダリング MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/remote/activitypub/misc/get-note-html.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/remote/activitypub/misc/get-note-html.ts (limited to 'src/remote/activitypub/misc') 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..a63059a38d --- /dev/null +++ b/src/remote/activitypub/misc/get-note-html.ts @@ -0,0 +1,18 @@ +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 += `

【投票】
${url}

`; + } + + return html; +} -- cgit v1.2.3-freya