Skip to content

Commit

Permalink
Fix #2725
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 17, 2018
1 parent 67ec10e commit f97cdfa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/remote/activitypub/misc/get-note-html.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
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;
}
14 changes: 14 additions & 0 deletions src/remote/activitypub/renderer/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ export default async function renderNote(note: INote, dive = true): Promise<any>

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 => {
if (x.type == 'mention' && x.host == null) {
return `${x.content}@${config.host}`;
Expand Down

0 comments on commit f97cdfa

Please sign in to comment.