jormungandr-bite/packages/backend/src/misc/is-instance-muted.ts
ThatOneCalculator 2aab2de38d refactor: 🎨 rome
2023-01-12 20:40:33 -08:00

21 lines
560 B
TypeScript

import type { Packed } from "./schema.js";
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;
}