yumechi-no-kuni/src/remote/activitypub/misc/get-note-html.ts

24 lines
634 B
TypeScript
Raw Normal View History

2018-06-18 00:28:43 -05:00
import { INote } from '../../../models/note';
2018-04-21 20:44:17 -05:00
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;
2018-06-17 01:58:23 -05:00
let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
2018-04-21 20:44:17 -05:00
if (note.poll != null) {
const url = `${config.url}/notes/${note._id}`;
// TODO: i18n
2018-05-07 02:31:33 -05:00
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>`;
2018-04-21 20:44:17 -05:00
}
return html;
}