This commit is contained in:
syuilo 2018-09-17 11:59:24 +09:00
parent 67ec10e86d
commit f97cdfaa20
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 14 additions and 12 deletions

View File

@ -1,22 +1,10 @@
import { INote } from '../../../models/note'; import { INote } from '../../../models/note';
import toHtml from '../../../mfm/html'; import toHtml from '../../../mfm/html';
import parse from '../../../mfm/parse'; import parse from '../../../mfm/parse';
import config from '../../../config';
export default function(note: INote) { export default function(note: INote) {
let html = toHtml(parse(note.text), note.mentionedRemoteUsers); let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
if (html == null) html = ''; 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; return html;
} }

View File

@ -82,6 +82,20 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
const files = await promisedFiles; const files = await promisedFiles;
if (note.poll != null) {
if (note.text == null) note.text = '';
const url = `${config.url}/notes/${note._id}`;
// TODO: i18n
note.text += `\n\n[投票を見る](${url})`;
}
if (note.renoteId != null) {
if (note.text == null) note.text = '';
const url = `${config.url}/notes/${note.renoteId}`;
note.text += `\n\nRE: ${url}`;
}
// 省略されたメンションのホストを復元する
const text = note.text ? parseMfm(note.text).map(x => { const text = note.text ? parseMfm(note.text).map(x => {
if (x.type == 'mention' && x.host == null) { if (x.type == 'mention' && x.host == null) {
return `${x.content}@${config.host}`; return `${x.content}@${config.host}`;