more timeline filters - #228
This commit is contained in:
parent
4c69cbcd2b
commit
d27ce442ea
7 changed files with 144 additions and 10 deletions
|
|
@ -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がブロックされているユーザーが関わるものだったら無視する
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue