diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-05-23 21:56:28 +0000 |
|---|---|---|
| committer | Amelia Yukii <amelia.yukii@shourai.de> | 2024-05-23 21:56:28 +0000 |
| commit | d27ce442eab9ae8e2f4ddff1e8ca0d0412e73046 (patch) | |
| tree | 4eccd67e2159ca02de8b67730bfabf40ee11e0c0 /packages/backend/src/server/api/stream/channels/channel.ts | |
| parent | merge: update list of project members (!452) (diff) | |
| download | sharkey-d27ce442eab9ae8e2f4ddff1e8ca0d0412e73046.tar.gz sharkey-d27ce442eab9ae8e2f4ddff1e8ca0d0412e73046.tar.bz2 sharkey-d27ce442eab9ae8e2f4ddff1e8ca0d0412e73046.zip | |
more timeline filters - #228
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/channel.ts')
| -rw-r--r-- | packages/backend/src/server/api/stream/channels/channel.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 90ee1ecda5..61bb4bfae2 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -15,6 +15,8 @@ class ChannelChannel extends Channel { public static shouldShare = false; public static requireCredential = false as const; private channelId: string; + private withFiles: boolean; + private withRenotes: boolean; constructor( private noteEntityService: NoteEntityService, @@ -29,6 +31,8 @@ class ChannelChannel extends Channel { @bindThis public async init(params: any) { this.channelId = params.channelId as string; + this.withFiles = params.withFiles ?? false; + this.withRenotes = params.withRenotes ?? true; // Subscribe stream this.subscriber.on('notesStream', this.onNote); @@ -38,6 +42,10 @@ class ChannelChannel extends Channel { private async onNote(note: Packed<'Note'>) { if (note.channelId !== this.channelId) return; + if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; + + if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return; + // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (isUserRelated(note, this.userIdsWhoMeMuting)) return; // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する |