Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring registration emails in line with v2 statuses #10720

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

dunkOnIT
Copy link
Contributor

@dunkOnIT dunkOnIT commented Jan 27, 2025

This addresses a few different issues:

  • The email we were sending people when they were moved from Cancelled -> Pending was an old email that still viewed the Pending list as the Waiting List - I've removed that
  • When moved from Cancelled -> Pending, a user should get a fresh "you just registered" email, not a "you're now pending" email - fixed that
    • Same should apply for Rejected, so I added that case
  • We weren't sending anyone an email when they got moved to the actual Waiting List - so I've added an email for that

TODO:

  • Get tests passing
  • Add mailer tests for waitlisted email

@dunkOnIT dunkOnIT marked this pull request as ready for review January 27, 2025 17:40
@@ -15,7 +15,6 @@
let(:registration) { FactoryBot.create(:registration, user: french_user, competition: competition_with_organizers) }
let(:mail_new) { RegistrationsMailer.notify_registrant_of_new_registration(registration) }
let(:mail_accepted) { RegistrationsMailer.notify_registrant_of_accepted_registration(registration) }
let(:mail_pending) { RegistrationsMailer.notify_registrant_of_pending_registration(registration) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this disappearing without replacement? There is notify_registrant_of_waitlisted_registration now, which you could well put here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header test seems to rely on a french translation key which we don't have - should I add it in in order for the test to pass? I can find some french people to consult with

@@ -164,6 +164,49 @@
registration = Registration.find_by(user_id: user.id, competition_id: favourites_reg.competition.id)
expect(registration.event_ids.sort).to eq(new_event_ids.sort)
end

it 'user gets registration email if they cancel and re-register' do
perform_enqueued_jobs do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only need to wrap perform_enqueued_jobs around those parts of your test that actually enqueue the job. So in this case, it would probably be the patch below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to just write your test as usual, and call perform_enqueued_jobs directly as a method to "flush" the job queue, without passing a do block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

end

it 'user gets registration email if they were rejected and get moved to pending' do
perform_enqueued_jobs do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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.

2 participants