Skip to content

feat: Complete end-to-end wiring of newsletter subscription process

stephen requested to merge newsletter_signup_confirmation_via_resque into main

This MR adds the necessary link between two previous MRs - one which set up the first half of the process by which a donor could indicate their interest in newly subscribing to the Tor newsletter, and one which handled inbound traffic from a confirmation email that would confirm that, yes, they do intend to subscribe.

The "missing link" between the two halves of these process was, in the prior incarnation of the donate site, a bespoke invocation of a local email client. That client would send an email to the interested donor directly, including a URL in the email with unique URL parameters which would, when clicked, redirect the user back to the donate site, whereupon confirmation of the user's intent to subscribe would be handled.

Since we use CiviCRM for all of Tor's other mailings, and since we are serving the new version of the donate site from inside containers, where it would be more complicated and a bigger hassle to arrange for outbound email, it seemed like a good idea to allow CiviCRM to handle these newsletter confirmation emails - and that's what we do now.

When a user indicates their interest to subscribe to the Tor newsletter, and after we validate their information and store that intent in a temporary Redis entry, we now leverage the Redis controller's ability to communicate with CiviCRM via Resque messaging. Specifically, we message the class Tor\Subscription\SendConfirm with the user's email address and the relevant Redis token as arguments.

CiviCRM retrieves this message and sends the confirmation email to the user at the provided email, with a confirmation link shaped like [tor donate server]/confirm-subscription?token=[32-character token]. When clicked, the user is directed back to the donate site, where tordonate.civicrm.confirm_subscription() handles the rest of the signup process.

This MR also cleans up that subsequent signup process, and adds comments throughout the newsletter portion of the CiviCRM repository code, for the sake of future maintainers. It also recompiles the front-end static assets to ensure the front end renders properly.

Merge request reports

Loading