Skip to content

Send request cancellation email to the request sender as well as the partner (5564)#5606

Open
augustocbx wants to merge 1 commit into
rubyforgood:mainfrom
augustocbx:5564-send-request-cancellation-to-request-sender
Open

Send request cancellation email to the request sender as well as the partner (5564)#5606
augustocbx wants to merge 1 commit into
rubyforgood:mainfrom
augustocbx:5564-send-request-cancellation-to-request-sender

Conversation

@augustocbx

Copy link
Copy Markdown

Resolves #5564

Description

When a request is cancelled, the cancellation notification email was only sent to the partner's main email address. As the issue notes, the partner's official email is often a higher-level contact or an address no longer monitored, so the person who actually submitted the request would not hear that it was cancelled.

This change adds the request sender to the recipients while keeping the partner. The sender is resolved through the existing Request#requester method, which returns the requesting partner user when one is recorded and falls back to the partner otherwise. The recipient list is deduplicated, so a request with no associated user still results in a single email to the partner (no behaviour change for that case).

Considered alternatives: reading partner_user directly in the mailer, but requester already encapsulates the "partner user or partner" fallback and is the documented way to identify who made the request.

No user-facing workflow changes, so no documentation update is needed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added/updated examples in spec/mailers/request_mailer_spec.rb:

  • when the request was sent by a partner user, the email is sent to both the partner and the request sender;
  • when the request has no partner user, the email is sent only to the partner.

Commands run:

  • bundle exec rspec spec/mailers/request_mailer_spec.rb — 3 examples, 0 failures
  • bundle exec rspec spec/services/request_destroy_service_spec.rb — 8 examples, 0 failures
  • bundle exec rubocop app/mailers/request_mailer.rb spec/mailers/request_mailer_spec.rb — no offenses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request cancellation - the email goes to the partner. Should probably also go to the user who sent the request.

1 participant