Expand description
Composer message handlers for Avestruz.
A note, a reply or a quote is written in a view of its own. What is written belongs to what it is written to: leaving the composer keeps the text as that target’s draft, and coming back finds it. The draft of a new note is also written to a file whenever the composer or the popup is left, so it is there after a restart.
Cancel, beside the way to publish, leaves and keeps nothing, without asking: it is what rubbing out all that was written and then leaving comes to, so there is no draft after it, and the files on their way to be attached are called off.
Backspace leaves the composer as well, and may keep nothing too (see
Leaving). With nothing written there is
nothing to keep, and it leaves. With something written it asks first:
keep it as a draft, discard it, or go on writing.
flowchart TD
key["Backspace, with nothing in the text for it to rub out, or with the keyboard out of the text"] --> held{"Was it held down, rubbing the text out until a moment ago?"}
held -->|"yes"| nothing["Nothing: rubbing out what was written is not leaving"]
held -->|"no"| written{"Is anything written, or a file on its way to be attached?"}
written -->|"no"| leave["The composer is left, and there is no draft"]
written -->|"yes"| ask["It asks: keep it as a draft?"]
ask -->|"Enter"| keep["Left, and what was written is kept as the draft"]
ask -->|"Backspace"| discard["Left, and nothing is kept: the draft is gone, and the files are called off"]
ask -->|"Escape"| stay["Not left: the keyboard is back in the text"]A quote is written as a note is, with the note it quotes on show under the text. That note’s address is put under what was written when it goes out, and may be all that goes out: a quote needs nothing said.
What is written can be looked at as it would show once it is out, in place of the text: the control above the text chooses, and Ctrl+P is the other of the two. It is what publishing would send, read as a row reads a note and shown whole: Markdown, pictures, videos, the page it links to, the people it names and the notes it quotes, which are looked for as a list would look for them. The text is not written to meanwhile, so what shows is what would go out; a file that gets where it was going meanwhile shows too. Pressing somebody it names, or a note it quotes, leaves the composer as the way back does: what was written is kept.
flowchart LR
text["The text"] -->|"Preview, Ctrl+P"| note["As a note that is not one yet"]
note --> shown["Shown as a row would show it, whole"]
note -->|"it quotes notes"| sought["Looked for: the store, then the relays"]
sought -->|"it says the same still"| shown
shown -->|"Write, Ctrl+P"| text
shown -->|"Publish, Ctrl+Enter"| out["Signed and sent"]A file is attached by sending it to the account’s media servers and
putting its address in the text (see crate::handlers::media). What
the note says of that file goes out with it, as long as the address is
still in the text.
Publishing has the account’s signer sign (its key from the keyring, or its remote signer) and sends to the connected relays. Until a relay has taken it the text stays where it is; once one has, the note or the quote shows at the top of the feed, or the reply in its place in the thread.
Enums§
- Leaving 🔒
- What Backspace does to the composer, pressed to leave it.
Constants§
- PREVIEW_
TAB 🔒 - RUBBING_
OUT 🔒 - How long after the text was last rubbed out a Backspace is still taken for the one that did it, held down: longer than the gap between the repeats of a held key, which come some thirty to a second, and shorter than the gap between two presses made on purpose.
- WRITE_
TAB 🔒 - Where writing is in the control that chooses between it and the look at how what is written would show, and where the look is.
Functions§
- held_
from_ 🔒rubbing_ out - Whether a Backspace pressed at
nowis one held down that has been rubbing the text out, which was last changed atrubbed. - is_
the_ 🔒same_ with_ more - Whether
foundisshown, which is being written and looked at, with no fewer of the notes it quotes: what was looked for when it said something else is not what it says now. - outgoing 🔒
- What is in
composeras it would go out: the text, without the space around it, and under the text of a quote the address of the note it quotes. - publish 🔒
- Have
signersigntextasauthor’s note, or reply to whattargetnames, whichansweredwrote, and send it to the relays, withsaidfor what it says of the files it links to. The text of a quote names what it quotes already. Returns it as a row shows it. - publish_
error_ 🔒text - Why an event did not go out, in the user’s language.
- publish_
failure_ 🔒text - Why what was written did not go out, in the user’s language.