From 7603ecddac761138e4d21bafeca6ec52961df852 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Wed, 2 Oct 2024 12:28:41 -0400 Subject: [PATCH] respect domain mutes --- .../backend/src/server/api/endpoints/notes/following.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/following.ts b/packages/backend/src/server/api/endpoints/notes/following.ts index 189c4b7ce6..71ed364d65 100644 --- a/packages/backend/src/server/api/endpoints/notes/following.ts +++ b/packages/backend/src/server/api/endpoints/notes/following.ts @@ -4,7 +4,7 @@ */ import { Inject, Injectable } from '@nestjs/common'; -import { LatestNote, MiFollowing, MiBlocking, MiMuting } from '@/models/_.js'; +import { LatestNote, MiFollowing, MiBlocking, MiMuting, MiUserProfile } from '@/models/_.js'; import type { NotesRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; @@ -54,6 +54,7 @@ export default class extends Endpoint { // eslint- super(meta, paramDef, async (ps, me) => { let query = this.notesRepository .createQueryBuilder('note') + .innerJoin(MiUserProfile, 'user_profile', ':me = user_profile."userId"') .setParameter('me', me.id) // Limit to latest notes @@ -70,7 +71,8 @@ export default class extends Endpoint { // eslint- // Respect blocks and mutes .leftJoin(MiBlocking, 'b', 'note."userId" = b."blockerId"') .leftJoin(MiMuting, 'm', 'note."userId" = m."muteeId"') - .where('b.id IS NULL AND m.id IS NULL') + .andWhere('b.id IS NULL AND m.id IS NULL') + .andWhere('note."userHost" IS NULL OR NOT user_profile."mutedInstances" ? note."userHost"') // Limit to followers .innerJoin(MiFollowing, 'following', 'latest.user_id = following."followeeId"')