AP: 投票をレンダリング
This commit is contained in:
@@ -22,7 +22,6 @@ export default async function(actor: IRemoteUser, uri: string): Promise<void> {
|
||||
$set: {
|
||||
deletedAt: new Date(),
|
||||
text: null,
|
||||
textHtml: null,
|
||||
mediaIds: [],
|
||||
poll: null
|
||||
}
|
||||
|
18
src/remote/activitypub/misc/get-note-html.ts
Normal file
18
src/remote/activitypub/misc/get-note-html.ts
Normal file
@@ -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 += `<p>【投票】<br />${url}</p>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
@@ -4,6 +4,7 @@ import config from '../../../config';
|
||||
import DriveFile from '../../../models/drive-file';
|
||||
import Note, { INote } from '../../../models/note';
|
||||
import User from '../../../models/user';
|
||||
import toHtml from '../misc/get-note-html';
|
||||
|
||||
export default async function renderNote(note: INote, dive = true) {
|
||||
const promisedFiles = note.mediaIds
|
||||
@@ -48,7 +49,7 @@ export default async function renderNote(note: INote, dive = true) {
|
||||
id: `${config.url}/notes/${note._id}`,
|
||||
type: 'Note',
|
||||
attributedTo,
|
||||
content: note.textHtml,
|
||||
content: toHtml(note),
|
||||
published: note.createdAt.toISOString(),
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
cc: `${attributedTo}/followers`,
|
||||
|
Reference in New Issue
Block a user