Skip to content

Keep a stashed draft's photos and poll - #96

Merged
simonhamp merged 1 commit into
mainfrom
feat/stash-attachments
Oct 27, 2026
Merged

simonhamp merged 1 commit into
mainfrom
feat/stash-attachments

Conversation

@simonhamp

@simonhamp simonhamp commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

The stash only kept a draft's text. Closing the composer sheet threw away its photos, deleting them from the phone, and its poll. Now a draft keeps its photos (with their descriptions) and its poll (with its length), and the sheet opens on all of it again, marked stash@{0}. The web stashes photos too. It doesn't stash polls, but losing a half-written poll was the same complaint, so the app keeps them.

How it works:

  • Stash stores a StashedDraft (body, photos, poll, poll length) instead of a string. A draft kept as a plain string before this still reads as text.
  • The sheet stashes the whole draft whenever the text, a photo, a description or the poll changes. Closing the sheet no longer deletes the photos. Drop does, and so do signing out and a draft falling off the 50-draft limit.
  • DraftImages used to delete every photo older than a day. Now it skips any photo a stashed draft or an outbox commit still holds, so a stashed photo isn't lost overnight. Photos nothing holds still go after a day.
  • A poll you added but wrote nothing in doesn't count as a draft on its own. It still comes back if the draft has text.
  • Turning a draft into a /feature or /bug issue deletes its photos, since the issue doesn't take them.

The reply bar shares its draft with the reply sheet, so it now has to deal with photos. When the draft has some, a row under the field says "1 photo" or "2 photos" and opens the sheet when tapped, and Reply from the bar sends them with the text. A reply from the bar that devnull turns down comes back to the bar with its photos.

One fix along the way: on Android, Cancel in the reply sheet never handed the draft back to the bar, because Android doesn't send @dismiss when PHP closes the sheet. The bar kept its old text, and typing there overwrote what you'd written in the sheet. With photos in the draft that would have lost them, so hideCommitSheet() now hands the draft back straight away.

Things to look at:

  • forgetAttachments() no longer deletes photos unless asked. Every way photos leave a draft (✕ on a photo, drop, sent, issue, sign-out, eviction) now deletes them explicitly, or hands them to the outbox.
  • Pruning reads the signed-in user's stash and the outbox each time a photo is attached. That's a cache read and one query.

Screenshots

Android only. These were taken on an emulator against a local devnull API with seeded data. iOS is missing because I couldn't drive a simulator for it in this session.

compose: New commit: write some text, attach a photo, Cancel, open the composer again.

Android light Android dark
Before
After

quote-poll: Quote with a poll: write a take, add a poll with two options, Cancel, quote again. The after shot is also after force-quitting the app.

Android light Android dark
Before
After

reply-bar: Reply bar: type a reply, expand it, attach a photo in the sheet, press Back.

Android light Android dark
Before
After
  • No visible change

🤖 Generated with Claude Code

The stash only held the body, so closing the composer sheet threw away
its photos (deleting them from the phone) and its poll. Each draft now
keeps its photos with their descriptions and its poll with its length,
and the sheet opens on all of it again.

Photos stay on the phone while a stashed draft or an outbox commit
holds them, rather than going after a day. Drop, sign-out and the
50-draft limit delete them.

A reply's draft is shared with the commit page's reply bar, so the bar
now shows "N photos" under the field when the draft has some. Tapping
it opens the sheet, and Reply from the bar sends them. Cancel on
Android also hands the draft back to the bar now, since Android never
reports that the sheet has gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review October 27, 2026 15:22
@simonhamp
simonhamp merged commit 9e32f9c into main Oct 27, 2026
3 of 4 checks passed
@simonhamp
simonhamp deleted the feat/stash-attachments branch October 27, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant