Module draft
Expand description
A draft is kept, and shown where the conversation is listed.
What a person was writing and has not sent is theirs: it survives the window closing, it is there when they come back to that channel or that person, and the list of conversations says so before they open it — a draft you cannot find is a draft you have lost.
Two pieces here. DraftBook is the rule: a draft is per conversation, a
blank draft is no draft, and sending removes the draft only while it is still
the one that was sent (a word typed while the send was in flight is not
thrown away). preview is the line a listing draws: the first line of the
body, its runs of whitespace folded to one space, elided at a grapheme
boundary, prefixed “Draft: “.
Persistence is the app’s: a draft belongs on the person’s own record (theirs, on their other devices), never in the shared conversation. This module holds the rule set, not the storage.
Structs§
- Draft
Book - The drafts a person has, by conversation key.
Constants§
- DRAFT_
PREVIEW_ CHARS - How much of a draft a listing shows before eliding.