Repository navigation
Mail unsubscribe page and settings email card - #580
Merged
Merged
Conversation
Deploying nemar-website with
|
| Latest commit: |
d6923f5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1cbd9a7b.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-mail-unsubscribe-set.nemar-website.pages.dev |
This was referenced Nov 21, 2026
Merged
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.
Phase P5 of the community-mail epic (nemarOrg/nemar-cli#2260): the public unsubscribe page and the Settings "Email" card. Refs nemarOrg/nemar-cli#2265.
Merge order. Stacked on #573 (the
mail.*account copy) and must merge after it. It must also wait until the nemar-cli epic #2260 reaches nemar-clidev: the backend routes (/mail/unsubscribe/*,/users/me/email-preferences) are not on staging's API until then, and the strict drift tests in CI (account copy and the new mail category table) are red against nemar-clidevuntil then, on purpose.Summary
src/pages/unsubscribe/[token].astro: public, server-rendered fromGET /mail/unsubscribe/:token/info. Shows the category and masked address and two buttons ("Unsubscribe from ", "Unsubscribe from all NEMAR community mail"), explains why recalls cannot be turned off (mail.recall.why), links/settingsand the community mail policy. It never acts on load. A malformed token or the backend's 410link_invalidrenders one sentence and the settings link (status 410); a 503, 429 or network failure renders an "unavailable" sentence without the buttons. After a press the page shows "done" only when the backend's own info answer confirms the category is off, so a hand-typed?result=allshows nothing false.src/pages/api/mail/unsubscribe.ts: the endpoint both buttons post to (a plain form POST, works without JavaScript). Token in the body, not the URL; token shape (the backend'sTOKEN_RE) and scope are checked before anything is sent; forwardsList-Unsubscribe=One-Clickplusfrom=pageorscope=all; never forwards the visitor's cookie,Authorizationor identity headers; answers a 303 back to the page with?result=category|all|invalid|error./unsubscribe/*:Cache-Control: no-store,X-Robots-Tag: noindex, nofollow, a robots meta (newnoindexprop onBase.astro), no analytics installer (isAnalyticsExcludedPath, gated inBase.astroand checked again inside the installer), no OSA widget, not in the sitemap, andrel="noreferrer"on every link.apiFetchlog lines now redact the token segment of/mail/unsubscribe/<token>paths./unsubscribeand/api/mailare classified as app-host routes (the backend's link points atAPP_BASE_URL).src/pages/settings.astro: an "Email" card before "Privacy" with three switches (news, rfcs, maintenance) and a locked "Recalls: always on" row with themail.recall.whysentence. Loaded and saved in the browser through the/api/v1proxy (src/lib/mail-prefs-api.ts); the switches stay disabled until the load answers; a refused save puts the switch back and shows the backend'smessagefor the four refusal codes. Labels and descriptions come from the transcribed account copy.src/lib/mail-categories.ts: hand copy of nemar-clishared/contract/mail-categories.ts(ids,canBeTurnedOff,defaultOn, refusal codes), withtest/mail-categories-drift.test.tsin the same strict/soft shape as the mail-admin drift test; CI's sparse checkout of nemar-clidevnow includes the file (NEMAR_CLI_MAIL_CATEGORIES).Deviation from the brief
The page sends
Referrer-Policy: same-origin, notno-referrer. Underno-referrera browser sendsOrigin: nullwith the page's own form post, and the site's cross-site form check (ADR 0031) refuses it with 403, so the buttons would not work.same-originsends no Referer to any other origin, which is what keeps the token in; the middleware honors it as it does for the OIDC consent page.Test plan
bun run lint: cleanbun run typecheck: 0 errors, 0 warningsbun run testwith nemar-cli's epic branch as the contract: 202 files passed, 3 skipped; 5737 tests passed, 13 skippedbun run build: completedev(what CI uses): the mail category drift test and the account-copy parity test fail, as expected until the epic mergesastro dev:/unsubscribe/<bad>answers 410 with the privacy headers, the robots meta, and no analytics installer script (present on/about); a cross-site POST to the endpoint gets 403dev: open a real unsubscribe link, press each button, and toggle each switch in Settings