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/get-note-html.ts') 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 From 8c46e5b3d91d95ae119f8722cd0af85c8b0f12c3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 7 May 2018 16:31:33 +0900 Subject: 投稿のレンダリングを改善 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/remote/activitypub/misc/get-note-html.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/remote/activitypub/misc/get-note-html.ts') diff --git a/src/remote/activitypub/misc/get-note-html.ts b/src/remote/activitypub/misc/get-note-html.ts index a63059a38d..5bca4eed62 100644 --- a/src/remote/activitypub/misc/get-note-html.ts +++ b/src/remote/activitypub/misc/get-note-html.ts @@ -11,7 +11,12 @@ export default function(note: INote) { if (note.poll != null) { const url = `${config.url}/notes/${note._id}`; // TODO: i18n - html += `

【投票】
${url}

`; + html += `

【Misskeyで投票を見る】

`; + } + + if (note.renoteId != null) { + const url = `${config.url}/notes/${note.renoteId}`; + html += `

RE: ${url}

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