oliver-zehentleitner / maity

clean-up: web account: held mail change never hidden, notify-settings split, shared confirm, download and sessions helpers

Sign in to report

tsk-eed6xxgbssxn Open

From the web clean-up audit, area 17 (tsk-hgnbapyw7hnh), read at 80647565 (findings sent to lotse, seq 125528). Line numbers are from 80647565, so re-check them on current main. #57 hides a security decision when a read fails.

#57 Sessions: a held mail-address change can silently vanish, and the page reads serially (debt).

  • sessions.js:234-240: addressChange returns null when GET /me/notification-settings fails. The approve/reject block for a held address change then disappears without a word, though it is a security decision.
  • Every draw and every action makes three reads one after another: /auth/sessions (:62), /me/notifications?limit=0 (:63) and /me/notification-settings (:237).
  • Proposal: run the three reads with Promise.all, and show "could not read" instead of nothing.
  • Effort S. Risk low.

#50 Account / project Settings, Mine tab: notify-settings.js holds three unrelated modules (design).

  • notify-settings.js is 925 lines.
  • Account parts:
  • mail address: 128-244
  • mail modes: 246-383
  • time zone: 385-436
  • language forms: 438-513
  • browser notifications: 527-572
  • Parts that are not account settings:
  • the Mine tab of project Settings: M.mySettings 762-831 and startTab 833-859, called only from app.js:1823
  • the leave-project dialog (575-760), with its own focus trap (665-694) and its own freshKey UUID builder with a Math.random fallback (576-585)
  • the shared language helpers (M.languages, interfacePicker, languageName, writeLanguageName, languagePicker, 861-924), used by app.js:403/764/773, register.js:77/80/86 and members.js:969
  • The header (1-5) and README:1922 describe almost none of this.
  • Proposal: split it into languages.js, project-mine.js and notify-settings.js. Drop the freshKey fallback, since crypto.randomUUID is always present on an https hub.
  • Effort M. Risk low: mostly moves.

#53 Account / your data / orgs: "type the handle to delete" written three times (duplication).

  • Where: account.js:186-226 (profileDelete), your-data.js:92-127 (deletionPart) and orgs.js:261-293 (deletePart).
  • They share the busy/settle logic, the typed-handle comparison (account.js:195, your-data.js:97, orgs.js:269) and the handling of a step-up cancel.
  • Proposal: one M.dom.typedConfirm({handle, label, button, run}).
  • Effort S. Risk low.

#54 Your data / security / site-io: the generic file download lives in your-data.js (design).

  • your-data.js:32-42 save is exported as M.yourData.save.
  • security.js:30 uses it for recovery codes without a guard. site-io.js:297 guards it with "if (M.yourData)".
  • Proposal: move it to M.dom.saveFile.
  • Effort S. Risk low.

#55 Notifications / sessions / waiting: mark-read and the sessions read repeated, dead exports (duplication/slow path).

  • "POST read {ids}, then check skipped" exists three times: sessions.js:113-117 (markRead, not exported), notify.js:246-248 (the pinnedRow of the bell) and waiting.js:116-129.
  • /auth/sessions is read in four places, each followed by a find for the current session: sessions.js:62, sessions.js:268, notify.js:302 and waiting.js:144.
  • notify.js:302 and waiting.js:144 only need the current session but ask for ?ended=true, which brings 30 days of ended sessions.
  • M.sessions.mayConfirm and M.sessions.confirm (sessions.js:305) have no caller outside the file.
  • Proposal: export M.sessions.markRead(id), add M.sessions.current() that reads without ended, and trim the unused exports.
  • Effort S. Risk low.

#58 Settings / jour fixe series: the time-zone list is built twice (duplication/docs drift).

  • notify-settings.js:390-394 builds the zone list with M.i18n.browserZone().
  • jour-fixe-series.js:103-107 builds its own from Intl.supportedValuesOf and recomputes the browser zone inline.
  • The time-zone form is on the Settings tab of the account (notify-settings.js:512 via account.js:456), but README:206 and the views.md tab table (:5799) do not list it.
  • README:1929 says account.js holds "pictures, preferences and changing the password". Preferences are in preferences.js.
  • Proposal: one M.i18n.zoneList() or a shared zone field, and fix README and views.md.
  • Effort S. Risk low.

Order: #50 conflicts with tsk-chtvqs62cd10 (Settings sub-tabs, PR #1741), which moves the Mine tab. Start after it.