Remove BulletproofMailer and update UserMailer#batch_subscription_notification


The BulletproofMailer class in lib/bulletproof_mailer.rb was originally introduced to allow emails to be cancelled by calling abort_delivery, which throws an error and prevents an email from being sent. But as redsummernight points out, this workaround is no longer necessary in the current version of Rails.

To modernize the handling of aborted emails and clean up the codebase, it would be nice to make the following changes:

  1. Update UserMailer to extend ActionMailer::Base instead of BulletMailer::Base.

  2. Update UserMailer#batch_subscription_notification to use return instead of abort_delivery.

  3. Delete lib/bulletproof_mailer.rb.

Testing Instructions: We need to make sure that subscription notifications can be cancelled. Specifically:

  1. Log in as User A.

  2. Subscribe to User B.

  3. Log in as User B.

  4. Post a new work.

  5. Immediately after posting, edit the work and add it to an Anonymous collection.

  6. Wait for subscription notifications to be sent, and make sure that User A didn't receive an email.

  7. Check Resque to make sure that the subscription notification didn't produce a failed job.


March 24, 2020, 11:27 AM
  • Subscribed to my main account using an alt.

  • Posted a work as my main, edited to make anonymous:

  • Posted a work as my main, left not anonymous for comparison. ETA: deleted the not-anonymous work on my main. UserMailer#batch_subscription_notification should be aborted correctly.

The subscription email task runs every hour. I received emails for other subscriptions, but not for the aforementioned subscription to my main. listed no failed jobs.

Looks good!

ticking instant
March 24, 2020, 11:32 AM

For testing this one properly, you actually can’t post a work that will send a subscription email in the same period. The point is to check that it can abort the email properly, and it’ll only abort the email if there’s nothing to notify about.

EDIT: To clarify, it doesn’t have to be that there are no subscription emails whatsoever. Just that the same user doesn’t post any works that would send out subscription emails during that period.

March 24, 2020, 8:04 PM

Subscribed to myself, posted a work, edited the work to add it to an anon collection, went on console and sent subscription emails because I’m impatient. Didn’t get an email. Checked Resque and there was no failed job.

Looks good!



ticking instant


ticking instant





Affects versions

Fix versions





Required Access Level



Internal 0.9