Story #2282: Implements Mailman mailing list subscription#2444
Open
herzog0 wants to merge 4 commits into
Open
Conversation
8e50367 to
1a44f32
Compare
feat: add Mailman REST API client and config settings feat: add UserMailingListSubscription model feat: add mailing list subscribe/unsubscribe view and route feat: add subscribe result HTMX fragment and styles chore: add mailing list subscribe demo to component demo view chore: add mailman-members dev helper script fix: mailing list name chore: rename script feat: improve test script fix: hostname feat: wire up mailing list card feat: show success susbcribe card chore: request email verification feat: discard pending subscriptions when user unsub before verification feat: add email field to subscription model feat: add status field to subscription model feat: add pending logs to demo component feat: improve dev mm script feat: add boost owned email validation flow feat: Allow anonymous subscriptions and enhance pending state UI fix: csrf token injection fix: styles chore: improve subscription confirmation pages styles feat: improve subscription confirmation styles fix: centralize _CONFIRM_MAX_AGE value feat: improve email templates fix: font size fix: change doc chore: remove unused login url chore: add dev note to mailing list example card
1a44f32 to
18ed3a0
Compare
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.
Issue: #2282
Summary & Context
Implements the mailing list subscribe/unsubscribe flow backed by the Mailman REST API. Users (authenticated or anonymous) can subscribe to Boost mailing lists via a V3 card component; subscription state is tracked in Django and confirmed via a signed email link before Mailman is called.
Changes
mailing_list/client.py) - thin wrapper around the Mailman REST API exposingsubscribe,unsubscribe,is_confirmed, and_discard_pending; allpre_*flags are set toTruebecause Django owns the confirmation stepUserMailingListSubscriptionmodel + migration - new model tracking per-user subscription state (pending/active) keyed on(user, list_id)with a corresponding migrationmailing_list/views.py):QuickSubscribeView- HTMX-driven single-list subscribe for both authenticated and anonymous users; re-renders the card partial in-placeSubscribeView- multi-list subscribe/unsubscribe for authenticated users (used in the demo page; will be reused for the profile modal)ConfirmSubscriptionView- handles the signed confirmation link, calls Mailman, and upgrades the DB record toactive; renders success/invalid pagesMailingListCardMixin(mailing_list/mixins.py) - injects card context into any CBV; wired intoCommunityViewand available for future pages_mailing_list_card.htmlwith state-aware rendering (default / pending / active / error) and HTMX swap; newconfirm_success.html,confirm_invalid.html,_subscribe_result.html,_subscribe_success_card.html, and plain-text confirmation email templatemailing-list-card.css(spinner, badge, form loading states) andmailing-list-confirm.css(full-page success/error confirmation layout)mailman-coreandmailman-webservices enabled indocker-compose.yml;MAILMAN_REST_API_URL,MAILMAN_DEV_API_URL, andMAILMAN_LISTSadded toenv.templatescripts/dev-mailman-helpers) - shell script for seeding local Mailman lists and inspecting subscription state during developmentRisks & Considerations
django.core.signingwith a 7-day TTL and a fixed salt embedded in the source. The salt is not a secret (signing is not encryption), but rotating it invalidates all outstanding tokens.QuickSubscribeViewis stateless for anonymous users - there is no server-side record until confirmation. If the email is already subscribed, a live Mailman API check is made; if the API is unreachable the duplicate-check is skipped silently and Mailman will return 409 on confirm (handled as a no-op).SubscribeViewis currently only wired to the demo page - it will need to be adapted when the multi-selection profile modal is built.mailman-coreandmailman-webDocker services now start by default. Teams that don't need Mailman locally can comment them out or usedocker compose up web db redis.Screenshots
Peer-review testing steps
env.templatevalues forMAILMAN_REST_API_URL,MAILMAN_DEV_API_URL, andMAILMAN_LISTSinto your.envdocker compose up- verifymailman-corestarts on port 8001scripts/dev-mailman-helpersto seed the three Boost lists in the local Mailman instance (choosecreate lists)Maildevinbox athttp://localhost:1080/#//community/and test the mailing list card as an anonymous user - enter an email and verify a confirmation email is sent to maildevhttp://localhost:8000/v3/demo/components/#mailing-list-subscribe-livesave. This will unsubscribe you from the list (you can fully test subscriptions in multiple lists in this component btw)Self-review Checklist
Frontend