fix(account): one form and one Save for your account; the same for an account's page in Users
CI / lint (push) Successful in 2s
CI / integration (push) Failing after 1m8s
CI / unit (push) Successful in 1m36s
CI / publish (push) Skipped

Operator review of the Account page: two sections with two different
save buttons, one stuck to the next card and one beside a squeezed hint.
- Account: time zone and Email are one form; POST /account/ saves both,
  nothing unless all of it is valid. /account/email is gone.
- Users › account: Name and Email are one form; the rename route also
  saves the email switches. /settings/users/<id>/email is gone.
- The Email section is a plain section now (email_section); its hint sits
  under the switches, names the zone as the picker does, and links
  Notifications only for an admin.
- apply_email_form leaves a switch the form doesn't carry as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:05:41 -04:00
co-authored by Claude Opus 5.5
parent 31e32c173c
commit beae8a33f3
8 changed files with 102 additions and 106 deletions
+5 -3
View File
@@ -113,8 +113,8 @@ def role_defaults(user, settings: dict) -> dict[str, bool]:
def apply_email_form(user, form) -> tuple[dict, str | None]:
"""Apply an email form to `user`: "email" (when the form has it) and
"notify_alerts" / "notify_report" ("", "on" or "off"). Returns
"""Apply an email form to `user`: "email" and "notify_alerts" /
"notify_report" ("", "on" or "off"), each only when the form has it. Returns
({field: [before, after]} for what changed, None), or ({}, why) having
changed nothing."""
wanted = {}
@@ -124,7 +124,9 @@ def apply_email_form(user, form) -> tuple[dict, str | None]:
return {}, "That isn't an email address mail can reach."
wanted["email"] = address
for kind in KINDS:
value = form.get(f"notify_{kind}", "")
if f"notify_{kind}" not in form:
continue
value = form.get(f"notify_{kind}")
if value not in CHOICES:
return {}, "Pick On, Off or the role's default."
wanted[f"notify_{kind}"] = CHOICES[value]