iceshrimp-legacy/packages/backend/src/misc/is-instance-muted.ts
syuilo d071d18dd7
refactor: Use ESM (#8358)
* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
2022-02-27 11:07:39 +09:00

16 lines
545 B
TypeScript

import { 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;
}