Expand description
Notification levels and mutes, for communities, channels and DMs alike.
Two settings per scope, doing different jobs. Level decides what rings:
every message, only your name, or nothing. Mute greys the row, drops its
unread weight, and clamps the level to at most Mentions — a volume knob,
not an off switch, which is why Nothing is not a synonym for it.
Level resolves down the chain Community → Channel, most specific opinion winning. Mute unions down it: muting a community mutes every channel in it. With no opinion stored anywhere, what the conversation IS picks the level: a DM or a group chat rings for everything, a community only for your name.
Structs§
- Preview
- What a notification shows. Every platform passes its notification through
Preview::apply, so the setting means the same thing everywhere. - Resolved
- A scope’s settings after the chain has been walked.
- Scope
Prefs - One scope’s stored settings.
Nonemeans inherit;suppress_everyoneis only ever set at community scope. - Sender
- The name and avatar a notification shows for someone.
- Stream
Gate - Who Streamer Mode hides. Read once per notification, outside any state lock.
Enums§
- Content
Privacy - How much of a message a system notification reveals: the account’s
notif_content_privacysetting, read at notify time. - Message
Class - What a message is, loudest first. Resolved once at classification so a
suppressed @everyone is
Normaleverywhere downstream: notification, ping badge and muted-row count alike. - Notify
Level - What rings. Ordered loudest first, so the numeric rank orders “quieter”.
Constants§
- MUTE_
FOREVER mute_untilsentinel for a mute with no end.- MUTE_
OFF mute_untilsentinel for “not muted”.- STREAM_
MASK - Stands in for every name Streamer Mode hides. Fixed length, so it says nothing about the name.
Functions§
- all_
prefs - apply_
wire - Adopt a sibling device’s list wholesale. Returns the scopes whose settings actually moved, so the caller only has to repaint those.
- channel_
is_ listed - Whether
channel_idis one its community still lists. A channel nobody lists has no row to open, so its unread can never be seen or cleared. - community_
muted_ for_ chat - Whether a chat’s COMMUNITY is itself silenced, rather than this one room inside it. A surface that stands for the whole space must not grey because one channel is quiet.
- default_
level - The level a scope starts at when nothing on its chain says otherwise.
group_idis the Concord group the scope belongs to (or is), if any. - everyone_
allowed - Whether an authorized @everyone may ping, for a community. Two levers: the App Settings kill switch, which wins outright, and the community’s own choice under it. A channel has no say, deliberately.
- everyone_
pings_ for_ chat - Whether an @everyone in this chat still counts as someone calling your name.
- in_
legacy_ mute_ list - The predicate the older
vector/mutesprojection is both WRITTEN and READ with. Publishing one shape and applying another is how an inherited mute ratchets into a permanent per-channel one. - invalidate
- Drop the cache so the next warm re-reads the table.
- invalidate_
communities - Forget what was read off the communities: a channel set or an invite-link registry was rewritten, which can change both what is listed and whether a group is a group chat or a community.
- is_
community - Whether
community_idis a community rather than a group chat. A group chat is one channel behind no invite link; anything bigger or open to strangers is a community, and a busy one can’t ring for every message. - is_
loaded - Whether the table has actually been read. An unloaded cache answers
“default” for every scope, which is indistinguishable from “nothing is
stored” — so anything that WRITES state derived from it must check this
first, the same rule
synced_prefs::is_hydratedapplies to publishing. - is_
muted_ at - legacy_
muted_ for_ chat in_legacy_mute_listfor a chat, stored flag folded in likeresolve_chat.- muted_
for_ chat - next_
expiry - The soonest mute expiry still ahead of
now_ms, for arming one timer rather than one per mute. - now_ms
- passes
- Whether a message of this class rings at this level.
- prefs
- resolve
- Walk the chain for one scope.
community_idis the channel’s community, orNonefor a DM or for a community resolving itself. - resolve_
chat - A chat’s settings, with its stored
mutedflag folded in. That flag is the mirror this module keeps for the paths that predate it, and the landing point for a mute arriving over the oldervector/mutesprojection, so it counts as a mute in its own right rather than being assumed to agree. - resolve_
from - The chain arithmetic on its own: level takes the most specific opinion,
then
fallback; mute takes either, and the mute clamps the level it hands back. - resolve_
mentions contentwith each mention (@npub1…,nostr:npub1…, a bare npub, or the same forms of an nprofile) read as@name. An unknown npub stays as written, except while streaming, where it and anyone hidden read as@•••••.- ring_
for_ chat - What a chat’s row should badge with: full unread at
All, pings atMentions, nothing atNothing. - scan_
mentions - The scanner behind
resolve_mentions.lookupnames a bare npub, orNoneto leave its token as written. An nprofile is looked up by the npub it encodes. - sender
- Nickname, then name, then display name, else
fallback; masked with no avatar when the gate hides them. Every platform’s notification names a sender through this. - sender_
in senderinside a community: thenicknamethey go by there, unless you named them yourself.- set_
level - set_
mute - set_
prefs - Write a scope through to the database and the cache.
- set_
suppress_ everyone - strip_
ansi contentwithout terminal escape sequences: an ```ansi block’s colour codes are styling, and a notification has no way to show them.- sweep_
expired - Clear every mute whose timer has run out, returning the scopes that just
lapsed. Expiry is a write rather than a read: the callers of
mutedread a cached boolean, and making them all consult the clock instead would be the wrong fix. - to_wire
- This device’s table as the publishable projection.
- warm
- Read the table into memory. Called once when a database is opened, because every badge recount resolves every chat and a lazy load would put a SQLite round trip on that path.