Talk federation (#5534)

This commit is contained in:
MeiMei
2019-10-29 06:01:14 +09:00
committed by syuilo
parent 1e58b3daff
commit 245b08b624
6 changed files with 125 additions and 74 deletions

View File

@@ -12,7 +12,7 @@ import { Emoji } from '../../../models/entities/emoji';
import { Poll } from '../../../models/entities/poll';
import { ensure } from '../../../prelude/ensure';
export default async function renderNote(note: Note, dive = true): Promise<any> {
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<any> {
const promisedFiles: Promise<DriveFile[]> = note.fileIds.length > 0
? DriveFiles.find({ id: In(note.fileIds) })
: Promise.resolve([]);
@@ -145,6 +145,10 @@ export default async function renderNote(note: Note, dive = true): Promise<any>
}))
} : {};
const asTalk = isTalk ? {
_misskey_talk: true
} : {};
return {
id: `${config.url}/notes/${note.id}`,
type: 'Note',
@@ -160,7 +164,8 @@ export default async function renderNote(note: Note, dive = true): Promise<any>
attachment: files.map(renderDocument),
sensitive: note.cw != null || files.some(file => file.isSensitive),
tag,
...asPoll
...asPoll,
...asTalk
};
}