From d025177d2c96427341a2b381020fb9be14485a24 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 22 Oct 2023 22:53:11 +0200 Subject: [PATCH] [mastodon-client] Fix renoteMuting for streaming API --- .../backend/src/server/api/mastodon/streaming/channels/list.ts | 2 +- .../src/server/api/mastodon/streaming/channels/public.ts | 2 +- .../backend/src/server/api/mastodon/streaming/channels/tag.ts | 2 +- .../backend/src/server/api/mastodon/streaming/channels/user.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/list.ts b/packages/backend/src/server/api/mastodon/streaming/channels/list.ts index 0cb5968a1..4b6b7def4 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/list.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/list.ts @@ -74,7 +74,7 @@ export class MastodonStreamList extends MastodonStream { private async shouldProcessNote(note: Note | Packed<"Note">): Promise { if (!this.listUsers.includes(note.userId)) return false; if (note.channelId) return false; - if (note.renote && !note.text && this.renoteMuting.has(note.userId)) return false; + if (note.renoteId !== null && !note.text && this.renoteMuting.has(note.userId)) return false; if (this.userProfile && (await getWordHardMute(note, this.user, this.userProfile.mutedWords))) return false; if (note.visibility === "specified") return !!note.visibleUserIds?.includes(this.user.id); if (note.visibility === "followers") return this.following.has(note.userId); diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts index 7eb8c4d71..ada120301 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts @@ -71,7 +71,7 @@ export class MastodonStreamPublic extends MastodonStream { if (isInstanceMuted(note, new Set(this.userProfile?.mutedInstances ?? []))) return false; if (isUserRelated(note, this.muting)) return false; if (isUserRelated(note, this.blocking)) return false; - if (note.renote && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; + if (note.renoteId !== null && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; if (this.userProfile && (await getWordHardMute(note, this.user, this.userProfile.mutedWords))) return false; return true; diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/tag.ts b/packages/backend/src/server/api/mastodon/streaming/channels/tag.ts index f664f2dbb..f7728f45b 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/tag.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/tag.ts @@ -63,7 +63,7 @@ export class MastodonStreamTag extends MastodonStream { if (isInstanceMuted(note, new Set(this.userProfile?.mutedInstances ?? []))) return false; if (isUserRelated(note, this.muting)) return false; if (isUserRelated(note, this.blocking)) return false; - if (note.renote && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; + if (note.renoteId !== null && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; if (this.userProfile && (await getWordHardMute(note, this.user, this.userProfile.mutedWords))) return false; return true; diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/user.ts b/packages/backend/src/server/api/mastodon/streaming/channels/user.ts index a050546e8..113cb843a 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/user.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/user.ts @@ -98,7 +98,7 @@ export class MastodonStreamUser extends MastodonStream { if (isUserRelated(note, this.muting)) return false; if (isUserRelated(note, this.blocking)) return false; if (isUserRelated(note, this.hidden)) return false; - if (note.renote && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; + if (note.renoteId !== null && !isQuote(note) && this.renoteMuting.has(note.userId)) return false; if (this.userProfile && (await getWordHardMute(note, this.user, this.userProfile.mutedWords))) return false; return true;