Skip to content

feat: Add endpoints for CiviCRM mailing management

stephen requested to merge subscription-management-endpoints into main

CiviCRM, in several places, uses the donate website for any actions which would be user-facing and require a URL. This is the case for any actions a Tor newsletter subscriber - or subscriber-to-be - might take with their subscriptions to Tor mailings.

There is a great deal of code and CiviCRM design surrounding these URLs, how they are generated, where they are stored, et al., which is beyond the purview of this MR description, but the core of what this MR was designed to support can be found here: https://gitlab.torproject.org/tpo/web/civicrm/-/blob/production/sites/all/Mailing.php~#L933

This commit:

  • Adds civicrm/urls.py, which sets up the endpoints for mailing actions as well as routes for pages displayed after these actions are performed.
  • Adds civicrm/views.py, which provides handlers for the routes added by civicrm/urls.py.
  • Fleshes out civicrm/repository.py to include mailing_action(), a method which handles incoming subscription actions and redirects the user appropriately
  • Adds front-end templates for unsubscription from, resubscription to, and opting out of Tor mailings.
  • Updates to tordonate/urls.py and tordonate/apps.py to update the core URL registry with these new endpoints, as well as the DI wiring necessary for these new views to render properly.

Note that the "new subscription" page and its attending signup form will be the target of another MR, but due to the fact that we serve that page in case of a malformed newsletter management command, that template is also provided here as a non-interactive stub.

Merge request reports