Skip to content

Commit

Permalink
AO3-6773 Update invite_request_declined mailer preview
Browse files Browse the repository at this point in the history
  • Loading branch information
amecreate committed Nov 18, 2024
1 parent 73f00e0 commit a71abf5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/controllers/user_invite_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions features/other_a/invite_request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
And the email should have "Additional invitation request declined" in the subject
And the email to "notuser1" should be non-translated
2 changes: 1 addition & 1 deletion features/step_definitions/invite_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
1 change: 0 additions & 1 deletion test/mailers/previews/user_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a71abf5

Please sign in to comment.