Repository navigation
Show the Thundermail downtime banner in webmail - #263
Closed
aaspinwall wants to merge 11 commits into
Closed
aaspinwall wants to merge 11 commits into
aaspinwall wants to merge 11 commits into
Conversation
…261) The banner's row wrapper is always rendered so the header and content keep their rows when there is no banner; the narrow layout's explicit rows and the folder drawer move down one row, and a maximized message view hides the banner like the header.
…d the shell. (#261) The gate and the shell each fetched it, so a signed-in load requested it twice and the banner blinked out when the gate gave way.
…xample in .env.local.example. (#261)
…erves beside the OIDC issuer. (#261)
Member
|
Don't worry about this, I'll take care of it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Webmail now shows the Thundermail downtime banner that operators set on the Keycloak login page. It appears at the top of the login gate, in both the OIDC and app-password views, and as a full-width first row of the signed-in app.
Source: Keycloak's built-in theme messages endpoint,
GET {keycloak}/resources/{realm}/login/{locale}. It returns every login theme message with the realm's overrides merged in (getEnhancedMessages), as[{"key": "...", "value": "..."}]. The banner is themaintenanceNoticemessage, and its colour ismaintenanceNoticeType(info,warningorcritical), from feat(keycloak): downtime banner on the login screen thunderbird-accounts#1491. There is no Accounts endpoint and no Accounts dependency beyond those two theme messages.src/defines.ts:loginMessagesUrl(locale = "en")derives the URL from the existingOIDC_ISSUERby turning…/realms/tbprointo…/resources/tbpro/login/en:VITE_OIDC_ISSUER=https://auth.tb.pro/realms/tbpro) →https://auth.tb.pro/resources/tbpro/login/enhttps://auth.stage-thundermail.com/realms/tbpro) →https://auth.stage-thundermail.com/resources/tbpro/login/enhttp://localhost:3000/realms/tbpro) →http://localhost:3000/resources/tbpro/login/en, which the dev server already proxies to Keycloak (/resourcesinvite.config.js)/realms/<name>→ empty, and nothing is fetched.No new environment variable.
src/composables/useDowntimeBanner.ts:cache: 'no-store'andcredentials: 'omit';maintenanceNoticeand trims it. Empty or missing means no banner, and that is silent: it is what every load sees when no override is set;maintenanceNoticeTypeoutsideinfo|warning|criticalfalls back towarning, as the login theme does;''in the message is shown as'. The endpoint returns the rawMessageFormatpattern, and the Accounts runbook tells operators to type''for an apostrophe;console.warn('[banner] …'). Nothing in the boot path waits for it.src/App.vuecalls the composable once and passes the result as abannerprop toLoginGateand to the shell. The gate is always rendered first, while auth starts, so one load covers both and the banner does not blink out when the gate gives way to the app.src/components/DowntimeBanner.vueonly renders the prop, in the services-uiNoticeBar(already a dependency, 1.6.5). The message is plain text; HTML shows literally.overflow-wrap: anywheremakes a long URL wrap on a phone.src/components/LoginGate.vuetakes thebannerprop and renders it at the top of both views. The existing 12px stack gap spaces it, as it does the alpha warning.Shell layout in
src/App.vue:grid-template-rows: auto auto minmax(0, 1fr)..shell__banner) is always rendered, even with no banner, because otherwise the header and content would move up one row and the content row would collapse to zero height. With no banner the row is 0px tall.--top-nav-height/--spaces-bar-height, which would open it over a banner. It is now placed in the content row (grid-row: 3 / 4; top: 0; bottom: 0), so it opens below the header and banner. With no banner it lands where it did before.inert,aria-hidden,visibility: hidden). The banner comes back when the view is restored.Tests:
maintenanceNoticewithmaintenanceNoticeType: critical; an empty or missingmaintenanceNoticeis null with no warning; a non-OK response is null with one warning; an unknown type falls back towarning.Appstub the composable, so they make no network request.Implemented by an AI agent from a human-written plan and issue; the author reviewed the design, scope and tests.
Why?
Users who are already signed in never see the Keycloak login page, so they miss the banner that thunderbird/thunderbird-accounts#1491 shows there (#261). Reading the same realm message means one operator action, setting the
maintenanceNoticerealm override, shows the notice on the login page and in webmail. It is visible on the next webmail load, with no deploy on either side.Limitations and Notes
maintenanceNoticekey. Until then the key is missing, which is the normal "no banner" state: nothing is shown and nothing is logged. Merging first is harmless.[banner]warning) and webmail carries on. Maintenance that takes Keycloak down needs a notice outside Keycloak, as the #1491 runbook says.MessageFormatrules differ slightly here: a single'is dropped on the login page but shown in webmail, and{…}breaks the login page but is shown literally in webmail. The runbook already tells operators to use’/''and never braces.role="status"is on the bar, which is inserted already filled, so a screen reader may not announce it on insertion. It is the first thing in reading order. Announcement was not tested.thundermail-devcontainer, because Docker was not available. CI is authoritative.Applicable Issues
Closes #261
QA Log
Host-run on Node 24.22.1 (
.node-version), not in the dev container. On the host's default Node 26, 278 tests onmainalready fail, because Node's built-inlocalStoragehides happy-dom's.curl -sI -H "Origin: https://webmail.thundermail.com" https://auth.tb.pro/resources/tbpro/login/en:200,application/json,access-control-allow-originechoes the origin (Keycloak'sThemeResource.getLocalizationTextsbuilds its CORS response withallowAllOrigins(), so this does not depend on the client's web origins). Same onauth.stage-thundermail.com. Both return 585 entries, 44,672 bytes, and neither hasmaintenanceNoticeyet.npx vue-tsc --noEmit: 0 errors.npx vitest run: 159 files, 2709 tests passed (main: 158 files, 2704).npx eslint src tests/unit: 0 errors (one existing warning insrc/stores/mail-store.ts, also onmain).npx vite build: exit 0.response.okcheck, the?? 'warning'fallback, or the''unescape fails exactly that test.Not run: the dev container, local e2e against the stack, a visual check of the running app, and screenshots.
Screenshots
None. The local stack needs Docker, which was not available here. To take them:
./scripts/local-stack-up.sh, thennpm run devin the dev container). The pinnedthunderbird-accountstheme does not definemaintenanceNoticeyet, but a realm override works without it.- in the admin console (http://keycloak:8999/admin/master/console/,
- via the admin REST API, as #1491's
Checkadmin/admin): realmtbpro→ Realm settings → Localization → Realm overrides → English → Add translation, keymaintenanceNotice, valueScheduled maintenance 14:00–16:00 UTC.; optionallymaintenanceNoticeType=critical; ortest/e2e/utils/keycloak-admin.tsdoes:curl -s http://localhost:3000/resources/tbpro/login/en | grep maintenanceNotice.http://localhost:3000/?app-passwordstays on the sign-in form with the banner above the alpha warning;admin@example.org/admin): banner above the header;-X DELETE).