Skip to main content

Module notifications

Module notifications 

Source
Expand description

What others did that concerns the account: answered it, named it, quoted it, reacted to a note of its own, passed one on, zapped it.

All of these are events that name the account in a p tag, which is what the relays are asked for: notes and comments (kinds 1 and 1111), reactions (kind 7, NIP-25), reposts (kinds 6 and 16, NIP-18) and zap receipts (kind 9735, NIP-57). What each one is, is read off the event and off the note it is about, where that is at hand (see read):

flowchart TD
    event["An event that names the account"] --> own{"Did the account do it itself?"}
    own -->|"yes"| nothing["Nothing to tell"]
    own -->|"no"| kind{"Its kind"}
    kind -->|"a note, a comment"| said{"What it says"}
    said -->|"names the account in its text"| mention["Mentioned you"]
    said -->|"answers a note of the account's"| reply["Replied to you"]
    said -->|"answers someone else"| thread["Replied in a thread you are in"]
    said -->|"quotes a note of the account's"| quote["Quoted you"]
    said -->|"none of these"| mention
    kind -->|"a reaction, to the account last of all"| reaction["Reacted to your note"]
    kind -->|"a repost"| repost["Reposted your note"]
    kind -->|"a zap receipt"| zap["Zapped you: shown once the account's wallet service is known to have signed it"]

A zap receipt says who paid and how much, and anyone can write one. It counts when it is signed by the key the account’s own Lightning address answers with (NIP-57): until that key is known, and for an account with no such address, no zap is told of. See Notifications::set_zapper.

Which of them are new is one moment, kept for the account on this machine: what was written after the notifications were last looked at (see Notifications::unread).

Structs§

Listed 🔒
Where in the list of all notifications the ones each tab shows are.
Notification
One thing the account is told of.
Notifications
What the account is told of, newest first, and which of it each tab shows.

Enums§

Tab
Which of the notifications a list shows.
What
What someone did.

Constants§

COMMENT_MAX_CHARS 🔒
NOTIFICATIONS_PAGE
How many events are asked for at a time.
NOTIFICATION_KINDS 🔒
The kinds of event that tell the account of something.
PREVIEW_MAX_CHARS 🔒
How much of the note something is about is shown under it, and how much of what was said with a zap, in characters.

Functions§

about
The note event is about, which says what it tells of: the note a note answers, or else the first it quotes; the note a reaction is to, which is the last it names (NIP-25); the one a repost passes on or a zap receipt is for, which is the first.
filter
The question that finds what names account: so many events at most, written after since and at or before until, where those are given.
preview 🔒
The start of what note says, on one line: what stands for it where there is no room for it.
read
What event tells account of, if anything, with at_hand the notes such events are about, as far as they were found.