From a71abf53299a3f32d290ba20bd0a7696b3420e94 Mon Sep 17 00:00:00 2001 From: Amy S L Date: Mon, 18 Nov 2024 08:54:09 -0500 Subject: [PATCH] AO3-6773 Update invite_request_declined mailer preview --- app/controllers/user_invite_requests_controller.rb | 4 ++-- app/mailers/user_mailer.rb | 2 +- features/other_a/invite_request.feature | 13 +++++-------- features/step_definitions/invite_steps.rb | 2 +- test/mailers/previews/user_mailer_preview.rb | 1 - 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/controllers/user_invite_requests_controller.rb b/app/controllers/user_invite_requests_controller.rb index 5dea1f4fcc..48bc411f4e 100644 --- a/app/controllers/user_invite_requests_controller.rb +++ b/app/controllers/user_invite_requests_controller.rb @@ -55,11 +55,11 @@ def update params[:requests].each_pair do |id, quantity| unless quantity.blank? request = UserInviteRequest.find(id) - @user = User.find(request.user_id) + user = User.find(request.user_id) requested_total = request.quantity.to_i request.quantity = 0 request.save! - I18n.with_locale(@user.preference.locale.iso) do + I18n.with_locale(user.preference.locale.iso) do UserMailer.invite_request_declined(request.user_id, requested_total, request.reason).deliver_later end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 4621821f4e..d28d7fe097 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -238,7 +238,7 @@ def change_email(user_id, old_email, new_email) I18n.with_locale(@user.preference.locale.iso) do mail( to: @old_email, - subject: t('user_mailer.change_email.subject', app_name: ArchiveConfig.APP_SHORT_NAME) + subject: default_i18n_subject(app_name: ArchiveConfig.APP_SHORT_NAME) ) end end diff --git a/features/other_a/invite_request.feature b/features/other_a/invite_request.feature index 49e1e2c826..f3bebdeebb 100644 --- a/features/other_a/invite_request.feature +++ b/features/other_a/invite_request.feature @@ -164,16 +164,13 @@ Feature: Invite requests And the user "notuser1" exists and is activated And the user "user1" enables translated emails And all emails have been delivered - When I am logged in as "user1" - And as "user1" I request some invites - And I log out - When I am logged in as "notuser1" - And as "notuser1" I request some invites - And I log out + When as "user1" I request some invites + When as "notuser1" I request some invites When I view requests as an admin And I press "Decline All" - And I log out Then "user1" should be emailed + And the email should have "Additional invitation request declined" in the subject And the email to "user1" should be translated Then "notuser1" should be emailed - And the email to "notuser1" should be non-translated \ No newline at end of file + And the email should have "Additional invitation request declined" in the subject + And the email to "notuser1" should be non-translated diff --git a/features/step_definitions/invite_steps.rb b/features/step_definitions/invite_steps.rb index 7ff79a54ef..6adc74971e 100644 --- a/features/step_definitions/invite_steps.rb +++ b/features/step_definitions/invite_steps.rb @@ -128,7 +128,7 @@ def invite(attributes = {}) step %{I press "Send Request"} end -When("as {string} I request some invites") do |user| +When "as {string} I request some invites" do |user| step %{I am logged in as "#{user}"} step %{I go to my user page} step %{I follow "Invitations"} diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb index d47be287e9..55cc03f313 100644 --- a/test/mailers/previews/user_mailer_preview.rb +++ b/test/mailers/previews/user_mailer_preview.rb @@ -55,5 +55,4 @@ def creatorship_notification_data(creation_type) creation = create(creation_type, authors: [first_creator.default_pseud, second_creator.default_pseud]) [creation.creatorships.last, first_creator] end - end