summaryrefslogtreecommitdiff
path: root/packages/backend/src/misc/is-instance-muted.ts
blob: 2e1785b51706ab7e1aae4c5e8af9f8e907f91e71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Packed } from "./schema";

export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
	if (mutedInstances.has(note?.user?.host ?? '')) return true;
	if (mutedInstances.has(note?.reply?.user?.host ?? '')) return true;
	if (mutedInstances.has(note?.renote?.user?.host ?? '')) return true;

	return false;
}

export function isUserFromMutedInstance(notif: Packed<'Notification'>, mutedInstances: Set<string>): boolean {
	if (mutedInstances.has(notif?.user?.host ?? '')) return true;

	return false;
}