summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-05-31 11:24:00 +0100
committerdakkar <dakkar@thenautilus.net>2024-05-31 11:24:00 +0100
commit4ddee7b01e9a45e9f17f210ebe361b00e919073c (patch)
tree54658e54859295fb4dc71fa8435643731b6e53f6 /packages/backend/src/server/api/stream
parentfix: event propagation for reactions button in MkNote (diff)
parentmerge: feat: send edit events to servers that interacted (!515) (diff)
downloadsharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.tar.gz
sharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.tar.bz2
sharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.zip
Merge branch 'develop' into future
Diffstat (limited to 'packages/backend/src/server/api/stream')
-rw-r--r--packages/backend/src/server/api/stream/channels/channel.ts8
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 140dd3dd9b..865e4fed19 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;
+
if (this.isNoteMutedOrBlocked(note)) return;
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {