Skip to content

Commit e858cdc

Browse files
authored
Merge pull request openstreetmap#5689 from tomhughes/settings-fixes
User settings fixes
2 parents c50e4f5 + 3be14c2 commit e858cdc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/controllers/accounts_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def update
3131
(params[:user][:auth_provider] == current_user.auth_provider &&
3232
params[:user][:auth_uid] == current_user.auth_uid)
3333
update_user(current_user, user_params)
34-
if current_user.errors.count.zero?
34+
if current_user.errors.empty?
3535
redirect_to edit_account_path
3636
else
3737
render :edit

app/controllers/concerns/user_methods.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ def update_user(user, params)
5959
# Ignore errors sending email
6060
end
6161
else
62-
current_user.errors.add(:new_email, current_user.errors[:email])
63-
current_user.errors.add(:email, [])
62+
current_user.errors.delete(:email).each do |error|
63+
current_user.errors.add(:new_email, error)
64+
end
6465
end
6566

6667
user.restore_email!

0 commit comments

Comments
 (0)