summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/misc/get-note-html.ts
blob: f92e91c34e83d343f5af59ef83a3281272fd80ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { INote } from '../../../models/note';
import toHtml from '../../../mfm/html';
import parse from '../../../mfm/parse';
import config from '../../../config';

export default function(note: INote) {
	let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
	if (html == null) html = '';

	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;
}