Skip to content

Commit

Permalink
[issue-4351] hound cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Tooyosi committed Aug 7, 2024
1 parent 8a0e24f commit 883d2e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def update
prev_email = user.email
super do |user|
if user.email_changed?
user.update_attribute(:valid_email, true)
UserInfoChangedMailerWorker.perform_async(user.id, "email", prev_email)
user.update(valid_email: true)
UserInfoChangedMailerWorker.perform_async(user.id, 'email', prev_email)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/user_info_changed_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UserInfoChangedMailer < ApplicationMailer
def user_info_changed(user, info, previous_email=nil)
@user = user
@recipient_emails = [user.email]
@recipient_emails << previous_email if previous_email.present? && info == "email"
@recipient_emails << previous_email if previous_email.present? && info == 'email'

case info
when "email"
Expand All @@ -15,6 +15,6 @@ def user_info_changed(user, info, previous_email=nil)
template = "password_changed"
end

mail(to: @recipient_emails, subject: 'Limited subject', :template_name => template )
mail(to: @recipient_emails, subject: subject, template_name: template )
end
end
4 changes: 2 additions & 2 deletions spec/controllers/api/v1/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,13 @@ def update_request

context "when changing email" do
let(:put_operations) { {users: {email: "[email protected]"}} }
let!(:user_email){ user.email }
let!(:user_email) { user.email }

after(:each) do
update_request
end

it "sends an email to the new address if user is valid", focus: true do
it "sends an email to the new address if user is valid" do
expect(UserInfoChangedMailerWorker).to receive(:perform_async).with(user.id, "email", user_email)
end

Expand Down

0 comments on commit 883d2e5

Please sign in to comment.