feat: メディアタイムラインを輸入 (#103)

* メディアタイムラインの実装

* refactor(stream): ストリーミングにwithFilesオプションを実装

---------

Co-authored-by: tar_bin <tar.bin.master@gmail.com>
This commit is contained in:
まっちゃとーにゅ 2023-07-24 02:48:01 +09:00 committed by GitHub
parent bf06af04c8
commit 6d3f64f606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 1 deletions

View file

@ -12,6 +12,7 @@ class HomeTimelineChannel extends Channel {
public static shouldShare = true;
public static requireCredential = true;
private withReplies: boolean;
private withFiles: boolean;
constructor(
private noteEntityService: NoteEntityService,
@ -26,6 +27,7 @@ class HomeTimelineChannel extends Channel {
@bindThis
public async init(params: any) {
this.withReplies = params.withReplies as boolean;
this.withFiles = params.withFiles as boolean;
this.subscriber.on('notesStream', this.onNote);
}
@ -42,6 +44,9 @@ class HomeTimelineChannel extends Channel {
// Ignore notes from instances the user has muted
if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances ?? []))) return;
// ファイルを含まない投稿は除外
if (this.withFiles && (note.files === undefined || note.files.length === 0)) return;
if (['followers', 'specified'].includes(note.visibility)) {
note = await this.noteEntityService.pack(note.id, this.user!, {
detail: true,