AP: 投票をレンダリング
This commit is contained in:
parent
45dcfc8a00
commit
20e77196f2
|
@ -36,7 +36,7 @@
|
|||
</p>
|
||||
<div class="text">
|
||||
<a class="reply" v-if="p.reply">%fa:reply%</a>
|
||||
<mk-note-html v-if="p.textHtml" :text="p.text" :i="os.i" :class="$style.text"/>
|
||||
<mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/>
|
||||
<a class="rp" v-if="p.renote">RP:</a>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
|
|
|
@ -29,12 +29,6 @@ props:
|
|||
desc:
|
||||
ja: "投稿の本文 (ローカルの場合Markdown風のフォーマット)"
|
||||
en: "The text of this note (in Markdown like format if local)"
|
||||
- name: "textHtml"
|
||||
type: "string"
|
||||
optional: true
|
||||
desc:
|
||||
ja: "投稿の本文 (HTML) (投稿時は無視)"
|
||||
en: "The text of this note (in HTML. Ignored when posting.)"
|
||||
- name: "mediaIds"
|
||||
type: "id(DriveFile)[]"
|
||||
optional: true
|
||||
|
|
|
@ -29,12 +29,6 @@ props:
|
|||
desc:
|
||||
ja: "投稿の本文 (ローカルの場合Markdown風のフォーマット)"
|
||||
en: "The text of this note (in Markdown like format if local)"
|
||||
- name: "textHtml"
|
||||
type: "string"
|
||||
optional: true
|
||||
desc:
|
||||
ja: "投稿の本文 (HTML) (投稿時は無視)"
|
||||
en: "The text of this note (in HTML. Ignored when posting.)"
|
||||
- name: "mediaIds"
|
||||
type: "id(DriveFile)[]"
|
||||
optional: true
|
||||
|
|
|
@ -12,7 +12,6 @@ export interface IMessagingMessage {
|
|||
_id: mongo.ObjectID;
|
||||
createdAt: Date;
|
||||
text: string;
|
||||
textHtml: string;
|
||||
userId: mongo.ObjectID;
|
||||
recipientId: mongo.ObjectID;
|
||||
isRead: boolean;
|
||||
|
|
|
@ -38,7 +38,6 @@ export type INote = {
|
|||
poll: any; // todo
|
||||
text: string;
|
||||
tags: string[];
|
||||
textHtml: string;
|
||||
cw: string;
|
||||
userId: mongo.ObjectID;
|
||||
appId: mongo.ObjectID;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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`,
|
||||
|
|
|
@ -12,8 +12,6 @@ import { pack } from '../../../../../models/messaging-message';
|
|||
import publishUserStream from '../../../../../publishers/stream';
|
||||
import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../publishers/stream';
|
||||
import pushSw from '../../../../../publishers/push-sw';
|
||||
import html from '../../../../../text/html';
|
||||
import parse from '../../../../../text/parse';
|
||||
import config from '../../../../../config';
|
||||
|
||||
/**
|
||||
|
@ -77,7 +75,6 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
fileId: file ? file._id : undefined,
|
||||
recipientId: recipient._id,
|
||||
text: text ? text : undefined,
|
||||
textHtml: text ? html(parse(text)) : undefined,
|
||||
userId: user._id,
|
||||
isRead: false
|
||||
});
|
||||
|
|
|
@ -15,7 +15,6 @@ import Mute from '../../models/mute';
|
|||
import pushSw from '../../publishers/push-sw';
|
||||
import event from '../../publishers/stream';
|
||||
import parse from '../../text/parse';
|
||||
import html from '../../text/html';
|
||||
import { IApp } from '../../models/app';
|
||||
|
||||
export default async (user: IUser, data: {
|
||||
|
@ -63,7 +62,6 @@ export default async (user: IUser, data: {
|
|||
replyId: data.reply ? data.reply._id : null,
|
||||
renoteId: data.renote ? data.renote._id : null,
|
||||
text: data.text,
|
||||
textHtml: tokens === null ? null : html(tokens),
|
||||
poll: data.poll,
|
||||
cw: data.cw,
|
||||
tags,
|
||||
|
|
Loading…
Reference in New Issue