Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/forms/register_user_email_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def process_successful_submission(request_id, instructions)
# To prevent discovery of existing emails, we check to see if the email is
# already taken and if so, we act as if the user registration was successful.
if email_address_record&.user&.suspended?
send_suspended_user_email
send_suspended_user_email(email_address_record)
elsif email_taken? && user_unconfirmed?
update_user_language_preference
send_sign_up_unconfirmed_email(request_id)
Expand Down Expand Up @@ -151,10 +151,10 @@ def send_sign_up_confirmed_email
end
end

def send_suspended_user_email
def send_suspended_user_email(suspended_email_record)
UserMailer.with(
user: user,
email_address: email_address,
user: suspended_email_record.user,
email_address: suspended_email_record,
).suspended_create_account.deliver_now_or_later
end

Expand Down
3 changes: 3 additions & 0 deletions spec/forms/register_user_email_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
to: [registered_email_address],
subject: t('user_mailer.suspended_create_account.subject'),
)
expect(subject.send(:email_address_record).user).to eq(user)
end
it 'sends the correct email to a taken email on an unconfirmed user' do
user = create(*unconfirmed_user_registered_email)
Expand All @@ -49,6 +50,7 @@
to: [registered_email_address],
subject: t('user_mailer.suspended_create_account.subject'),
)
expect(subject.send(:email_address_record).user).to eq(user)
end
it 'sends the correct email to and unconfimed email on a confirmed user' do
old_user = create(:user)
Expand All @@ -62,6 +64,7 @@
to: [email_address.email],
subject: t('user_mailer.suspended_create_account.subject'),
)
expect(subject.send(:email_address_record).user).to eq(old_user)
end
end

Expand Down