Skip to content

Commit

Permalink
Fix: Blocked Host not to generate query if not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Dec 27, 2023
1 parent 8caf3b9 commit 4a33cf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/api/endpoints/federation/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export default define(meta, async (ps, me) => {
if (typeof ps.blocked === 'boolean') {
const meta = await fetchMeta(true);
if (ps.blocked) {
query.andWhere('instance.host IN (:...blocks)', { blocks: meta.blockedHosts });
query.andWhere(meta.blockedHosts.length === 0 ? '1=0': 'instance.host IN (:...blocks)', { blocks: meta.blockedHosts });
} else {
query.andWhere('instance.host NOT IN (:...blocks)', { blocks: meta.blockedHosts });
query.andWhere(meta.blockedHosts.length === 0 ? '1=1': 'instance.host NOT IN (:...blocks)', { blocks: meta.blockedHosts });
}
}

Expand Down

0 comments on commit 4a33cf0

Please sign in to comment.