Drafts survive a reload, a crash or a dropped connection #127

Merged
littlefox merged 2 commits from issue-104-drafts into main 2026-10-18 19:52:33 +00:00
Owner

Closes #104

  • Kept on the device as it's typed: localStorage in the browser, one file per draft in $XDG_DATA_HOME/neokom/drafts/ on the desktop (write-then-rename).
  • One draft per thread or new post. The id holds server, person, what the composer answers and its first recipients, so a personal reply is never offered in a public composer.
  • Opening the composer for the same thing offers the saved draft (restore / throw away; writing replaces it). While the reader is empty, "Utkast som inte skickats" lists drafts with "Fortsätt skriva" / "Släng".
  • Sending or "Avbryt" removes the draft; a reload, crash or dropped connection keeps it. Drafts older than 30 days are dropped.

Verified: unit tests for the format, the ids (public vs personal reply, per person) and the desktop file store; new drafts.spec.ts on desktop/Android/iPhone (reply survives a reload and is resumed from the list, offered again in the composer and restored, gone after Avbryt; a new post survives a reload and is gone once sent); full e2e 190/190; clippy native/wasm/desktop clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8

Closes #104 - Kept on the device as it's typed: localStorage in the browser, one file per draft in `$XDG_DATA_HOME/neokom/drafts/` on the desktop (write-then-rename). - One draft per thread or new post. The id holds server, person, what the composer answers and its first recipients, so a personal reply is never offered in a public composer. - Opening the composer for the same thing offers the saved draft (restore / throw away; writing replaces it). While the reader is empty, "Utkast som inte skickats" lists drafts with "Fortsätt skriva" / "Släng". - Sending or "Avbryt" removes the draft; a reload, crash or dropped connection keeps it. Drafts older than 30 days are dropped. Verified: unit tests for the format, the ids (public vs personal reply, per person) and the desktop file store; new `drafts.spec.ts` on desktop/Android/iPhone (reply survives a reload and is resumed from the list, offered again in the composer and restored, gone after Avbryt; a new post survives a reload and is gone once sent); full e2e 190/190; clippy native/wasm/desktop clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
What is being written is kept on the device as it's typed (localStorage
in the browser, a file per draft on the desktop), one per thread or new
post. Opening the composer for the same thing offers it back; after
login, drafts not sent are listed with 'Fortsätt skriva'. Sending or
cancelling removes it. The id includes what the composer started with,
so a personal reply is never offered in a public composer.

Refs #104

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Merge remote-tracking branch 'origin/main' into issue-104-drafts
All checks were successful
ci / check (push) Successful in 9m17s
ci / desktop (push) Successful in 13m41s
ci / e2e (push) Successful in 22m18s
cd6dd946c7
littlefox referenced this pull request from a commit 2026-10-19 05:23:04 +00:00
Sign in to join this conversation.
No description provided.