import { isMentioningMutedUsers } from '@/lib/event' import { muteSetHas } from '@/lib/mute-set' import { normalizeUrl } from '@/lib/url' import type { Event } from 'nostr-tools' /** Lowercase normalized URLs for comparing user-blocked relays (e.g. before REQ). */ export function buildNormalizedBlockedRelaySet(blockedRelays: readonly string[] | undefined): Set { const s = new Set() for (const u of blockedRelays ?? []) { const n = (normalizeUrl(u) || u).toLowerCase() if (n) s.add(n) } return s } /** Hide thread replies / backlinks: muted author or (when enabled) mentions of mutes. */ export function shouldHideThreadResponseEvent( evt: Event, mutePubkeySet: Set, hideContentMentioningMutedUsers: boolean | undefined ): boolean { if (muteSetHas(mutePubkeySet, evt.pubkey)) return true if (hideContentMentioningMutedUsers === true && isMentioningMutedUsers(evt, mutePubkeySet)) return true return false }