BUG: changing occasion resets the chosen theme (should not) #16

Closed
opened 2026-06-17 08:13:38 +00:00 by mAi · 2 comments
Collaborator

Bug (from #10)

m: „das Theme sollte nicht pro Anlass resetted werden, wenn ich den ändere.“

#10 wired the occasion picker to pre-select that occasion's default theme. Side effect: if the sender has already chosen a theme and then changes the occasion, their theme gets overwritten by the occasion default. Annoying — the explicit theme choice is lost.

Fix

Changing the occasion must not override a theme the user has chosen.

  • Cleanest: the occasion's default theme only applies while the user hasn't explicitly touched the theme selector. Once the user picks a theme, occasion changes leave it alone. (Track a 'theme touched' flag in the compose JS.)
  • Acceptable simpler variant if cleaner: occasion change never changes the theme at all (default theme only set on initial page state). Either way: an explicit theme choice survives occasion changes.
  • Progressive enhancement: no-JS behaviour (whatever theme radio is checked) stays correct.

Scope

Compose JS + maybe a tiny markup tweak (web/templates/compose.html). No backend/schema change. Don't regress #10 (occasion badge/title/default-theme-on-first-pick still fine).

Sequencing

Same compose track — fold in with the other in-flight compose work (#13#14#15); otto-head will slot it.

DoD

  • Pick a theme, then change occasion → theme stays as chosen.
  • Fresh card with no manual theme pick → still gets the occasion's sensible default.
  • build/vet/test green; verified; commit references this issue.
## Bug (from #10) m: *„das Theme sollte nicht pro Anlass resetted werden, wenn ich den ändere.“* #10 wired the occasion picker to pre-select that occasion's default theme. Side effect: if the sender has **already chosen a theme** and then changes the occasion, their theme gets **overwritten** by the occasion default. Annoying — the explicit theme choice is lost. ## Fix Changing the occasion must **not** override a theme the user has chosen. - Cleanest: the occasion's default theme only applies while the user hasn't explicitly touched the theme selector. Once the user picks a theme, occasion changes leave it alone. (Track a 'theme touched' flag in the compose JS.) - Acceptable simpler variant if cleaner: occasion change never changes the theme at all (default theme only set on initial page state). Either way: **an explicit theme choice survives occasion changes.** - Progressive enhancement: no-JS behaviour (whatever theme radio is checked) stays correct. ## Scope Compose JS + maybe a tiny markup tweak (`web/templates/compose.html`). No backend/schema change. Don't regress #10 (occasion badge/title/default-theme-on-first-pick still fine). ## Sequencing Same compose track — fold in with the other in-flight compose work (#13 → #14 → #15); otto-head will slot it. ## DoD - Pick a theme, then change occasion → theme stays as chosen. - Fresh card with no manual theme pick → still gets the occasion's sensible default. - build/vet/test green; verified; commit references this issue.
mAi self-assigned this 2026-06-17 09:28:40 +00:00
Author
Collaborator

Fixed

Changing the occasion no longer overwrites an explicitly chosen Farbwelt.

Approach (cleanest variant from the issue): a themeTouched flag in the compose JS. It starts false; picking any theme radio sets it true. The occasion-change handler only auto-applies the occasion's data-theme-default while themeTouched is false:

let themeTouched = false;
for (const r of themeRadios) {
  r.addEventListener('change', () => { themeTouched = true; document.body.dataset.theme = r.value; });
}
// ...occasion change:
if (!themeTouched) applyDefaultTheme(r.dataset.themeDefault);

DoD

  • Pick a theme, then change occasion → theme stays as chosen.
  • Fresh card, no manual theme pick → still gets the occasion's sensible default (#10 behaviour intact).
  • Progressive enhancement: no-JS uses whatever radio is checked — unchanged.
  • #10 not regressed: occasion badge/title + default-theme-on-first-pick still work.
  • build / vet / test green.

Bundled with #17, #20 and the #19 admin-TTL tweak in one shift per otto-head.

Commit: 3ae968445b
Branch: mai/hermes/issue-16-bug-changing (otto-head merges + deploys)

## Fixed ✅ Changing the occasion no longer overwrites an explicitly chosen Farbwelt. **Approach** (cleanest variant from the issue): a `themeTouched` flag in the compose JS. It starts `false`; picking any theme radio sets it `true`. The occasion-change handler only auto-applies the occasion's `data-theme-default` **while `themeTouched` is false**: ```js let themeTouched = false; for (const r of themeRadios) { r.addEventListener('change', () => { themeTouched = true; document.body.dataset.theme = r.value; }); } // ...occasion change: if (!themeTouched) applyDefaultTheme(r.dataset.themeDefault); ``` **DoD** - ✅ Pick a theme, then change occasion → theme stays as chosen. - ✅ Fresh card, no manual theme pick → still gets the occasion's sensible default (#10 behaviour intact). - ✅ Progressive enhancement: no-JS uses whatever radio is checked — unchanged. - ✅ #10 not regressed: occasion badge/title + default-theme-on-first-pick still work. - ✅ build / vet / test green. _Bundled with #17, #20 and the #19 admin-TTL tweak in one shift per otto-head._ Commit: https://mgit.msbls.de/m/postcards/commit/3ae968445befd70116929bf5f2ed1adbfab8bd2f Branch: `mai/hermes/issue-16-bug-changing` (otto-head merges + deploys)
Author
Collaborator

Live — merged 3ae9684 (merge 9a8eda4), deployed. Theme stays on occasion change (themeTouched flag); default only applies until you pick a theme. Verified build green. Not closing — m closes.

## ✅ Live — merged `3ae9684` (merge `9a8eda4`), deployed. Theme stays on occasion change (themeTouched flag); default only applies until you pick a theme. Verified build green. Not closing — m closes.
mAi closed this issue 2026-06-23 15:48:03 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: m/postcards#16
No description provided.