This commit is contained in:
MeiMei 2018-11-23 02:10:07 +09:00 committed by syuilo
parent 2a0b62d26d
commit 336b45b6f7
3 changed files with 22 additions and 1 deletions

View file

@ -96,6 +96,13 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
// リプライ // リプライ
const reply = note.inReplyTo ? await resolveNote(note.inReplyTo, resolver) : null; const reply = note.inReplyTo ? await resolveNote(note.inReplyTo, resolver) : null;
// 引用
let quote: INote;
if (note._misskey_quote && typeof note._misskey_quote == 'string') {
quote = await resolveNote(note._misskey_quote).catch(() => null);
}
// テキストのパース // テキストのパース
const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content); const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content);
@ -112,7 +119,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
createdAt: new Date(note.published), createdAt: new Date(note.published),
files: files, files: files,
reply, reply,
renote: undefined, renote: quote,
cw: note.summary, cw: note.summary,
text: text, text: text,
viaMobile: false, viaMobile: false,

View file

@ -42,6 +42,18 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
inReplyTo = null; inReplyTo = null;
} }
let quote;
if (note.renoteId) {
const renote = await Note.findOne({
_id: note.renoteId,
});
if (renote) {
quote = renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`;
}
}
const user = await User.findOne({ const user = await User.findOne({
_id: note.userId _id: note.userId
}); });
@ -112,6 +124,7 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
summary: note.cw, summary: note.cw,
content, content,
_misskey_content: text, _misskey_content: text,
_misskey_quote: quote,
published: note.createdAt.toISOString(), published: note.createdAt.toISOString(),
to, to,
cc, cc,

View file

@ -41,6 +41,7 @@ export interface IOrderedCollection extends IObject {
export interface INote extends IObject { export interface INote extends IObject {
type: 'Note'; type: 'Note';
_misskey_content: string; _misskey_content: string;
_misskey_quote: string;
} }
export interface IPerson extends IObject { export interface IPerson extends IObject {