Switching format keeps the original quote, not a flattened copy #409

Closed
opened 2026-09-19 22:13:52 +00:00 by jcoffey-dev · 0 comments
Owner

Summary

Reported against the build deployed today: switching a reply from plain text to rich text made the change but did not bring the original message back.

toggleFormat converted whichever body the draft was showing. From plain text that is the > quote, so the reply came back with the sender's message flattened — formatting, images and links gone — even though the original markup was on the draft the whole time, prepared by reply() along with the text one.

  • The draft now keeps both forms of the quote (quoteHtml, quoteText), and a format change re-attaches the right one instead of converting the other.
  • Only what the author typed above the quote is converted, so a half-written reply survives the switch and the quote is not doubled.
  • Where the quote can't be found — edited by hand, or a draft that quotes nothing, like a new message — the whole body is converted exactly as before.
  • Both directions are covered, and the ⋮ menu takes the same path as the offer bar.

Related issues

Follows Coffey-Labs/ihasmail#408, which is where the switch became easy enough to reach for that this showed up.

Translations

Adds none. The fallback count is unchanged at 16.

Testing

  • Three new component tests in format-offer-bar.test.tsx: the original markup is restored rather than the flattened quote, text typed above it survives with the quote appearing once, and the reverse direction lands the prepared text quote with no HTML in it. All three fail on the previous code — I ran them against it to be sure they pin the bug rather than the fix.
  • Two new store tests: reply() stores the quote in both forms and the draft's body ends with the text one; a message started from scratch quotes nothing.
  • npm test (1418 web, 251 server) and npm run typecheck pass.
  • Driven in Chrome against npm run dev:mock. Plain-text default, replied to the styled HTML message, typed a line, pressed Switch: the typed line stayed, the quote came back with its blockquote, card and images, no > lines remained, and the attribution appeared once. Rich default replying to a plain-text message and switching the other way gave a plain body with no tags, one attribution line and the typed line on top.

Merged 2026-09-19 as coffey-labs/ihasmail@88f9e6c50a

Rebuilt from: git history, session transcript.

## Summary Reported against the build deployed today: switching a reply from plain text to rich text made the change but did not bring the original message back. `toggleFormat` converted whichever body the draft was showing. From plain text that is the `> ` quote, so the reply came back with the sender's message flattened — formatting, images and links gone — even though the original markup was on the draft the whole time, prepared by `reply()` along with the text one. - **The draft now keeps both forms of the quote** (`quoteHtml`, `quoteText`), and a format change re-attaches the right one instead of converting the other. - **Only what the author typed above the quote is converted**, so a half-written reply survives the switch and the quote is not doubled. - **Where the quote can't be found** — edited by hand, or a draft that quotes nothing, like a new message — the whole body is converted exactly as before. - Both directions are covered, and the ⋮ menu takes the same path as the offer bar. ## Related issues Follows Coffey-Labs/ihasmail#408, which is where the switch became easy enough to reach for that this showed up. ## Translations Adds none. The fallback count is unchanged at 16. ## Testing - Three new component tests in `format-offer-bar.test.tsx`: the original markup is restored rather than the flattened quote, text typed above it survives with the quote appearing once, and the reverse direction lands the prepared text quote with no HTML in it. **All three fail on the previous code** — I ran them against it to be sure they pin the bug rather than the fix. - Two new store tests: `reply()` stores the quote in both forms and the draft's body ends with the text one; a message started from scratch quotes nothing. - `npm test` (1418 web, 251 server) and `npm run typecheck` pass. - Driven in Chrome against `npm run dev:mock`. Plain-text default, replied to the styled HTML message, typed a line, pressed Switch: the typed line stayed, the quote came back with its blockquote, card and images, no `> ` lines remained, and the attribution appeared once. Rich default replying to a plain-text message and switching the other way gave a plain body with no tags, one attribution line and the typed line on top. **Merged** 2026-09-19 as coffey-labs/ihasmail@88f9e6c50a04 <sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.