diff options
| author | Hazel K <acomputerdog@gmail.com> | 2024-10-02 13:23:01 -0400 |
|---|---|---|
| committer | Hazel K <acomputerdog@gmail.com> | 2024-10-02 13:23:01 -0400 |
| commit | d7f1e3f823f546aae0bf3f7a2d0e1add7bb97fc1 (patch) | |
| tree | aa2fe1d792e0234bca368d50bc40cc19ad62c163 /packages/backend/src/server/api | |
| parent | add menu to toggle user replies / boosts (diff) | |
| download | sharkey-d7f1e3f823f546aae0bf3f7a2d0e1add7bb97fc1.tar.gz sharkey-d7f1e3f823f546aae0bf3f7a2d0e1add7bb97fc1.tar.bz2 sharkey-d7f1e3f823f546aae0bf3f7a2d0e1add7bb97fc1.zip | |
respect blocks and mutes for replies and renotes
Diffstat (limited to 'packages/backend/src/server/api')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/notes/following.ts | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/following.ts b/packages/backend/src/server/api/endpoints/notes/following.ts index 71ed364d65..ac9730f631 100644 --- a/packages/backend/src/server/api/endpoints/notes/following.ts +++ b/packages/backend/src/server/api/endpoints/notes/following.ts @@ -68,11 +68,23 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- .leftJoinAndSelect('renote.user', 'renoteUser') .leftJoinAndSelect('note.channel', 'channel') - // Respect blocks and mutes - .leftJoin(MiBlocking, 'b', 'note."userId" = b."blockerId"') - .leftJoin(MiMuting, 'm', 'note."userId" = m."muteeId"') - .andWhere('b.id IS NULL AND m.id IS NULL') - .andWhere('note."userHost" IS NULL OR NOT user_profile."mutedInstances" ? note."userHost"') + // Respect blocks and mutes for latest note + .leftJoin(MiBlocking, 'blocking_note', 'note."userId" = blocking_note."blockerId"') + .leftJoin(MiMuting, 'muting_note', 'note."userId" = muting_note."muteeId"') + .andWhere('blocking_note.id IS NULL AND muting_note.id IS NULL') + .andWhere('(note."userHost" IS NULL OR NOT user_profile."mutedInstances" ? note."userHost")') + + // Respect blocks and mutes for renote + .leftJoin(MiBlocking, 'blocking_renote', 'renote."userId" IS NOT NULL AND renote."userId" = blocking_renote."blockerId"') + .leftJoin(MiMuting, 'muting_renote', 'renote."userId" IS NOT NULL AND renote."userId" = muting_renote."muteeId"') + .andWhere('blocking_renote.id IS NULL AND muting_renote.id IS NULL') + .andWhere('(renote."userHost" IS NULL OR NOT user_profile."mutedInstances" ? renote."userHost")') + + // Respect blocks and mutes for reply + .leftJoin(MiBlocking, 'blocking_reply', 'reply."userId" IS NOT NULL AND reply."userId" = blocking_reply."blockerId"') + .leftJoin(MiMuting, 'muting_reply', 'reply."userId" IS NOT NULL AND reply."userId" = muting_reply."muteeId"') + .andWhere('blocking_reply.id IS NULL AND muting_reply.id IS NULL') + .andWhere('(reply."userHost" IS NULL OR NOT user_profile."mutedInstances" ? reply."userHost")') // Limit to followers .innerJoin(MiFollowing, 'following', 'latest.user_id = following."followeeId"') |