]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #5689 from tomhughes/settings-fixes
authorAndy Allan <git@gravitystorm.co.uk>
Sun, 16 Feb 2025 14:17:44 +0000 (14:17 +0000)
committerGitHub <noreply@github.com>
Sun, 16 Feb 2025 14:17:44 +0000 (14:17 +0000)
User settings fixes

app/controllers/accounts_controller.rb
app/controllers/concerns/user_methods.rb

index 085d1bfea055091af3a074b552713edea291980c..d02943640147a37476832d74fed15a107a314af2 100644 (file)
@@ -31,7 +31,7 @@ class AccountsController < ApplicationController
        (params[:user][:auth_provider] == current_user.auth_provider &&
         params[:user][:auth_uid] == current_user.auth_uid)
       update_user(current_user, user_params)
-      if current_user.errors.count.zero?
+      if current_user.errors.empty?
         redirect_to edit_account_path
       else
         render :edit
index d79ed48d2ca742be14faad6db9f637b09dd247e4..447aea3fce3013ac2734992c4c8648ad612ce339 100644 (file)
@@ -59,8 +59,9 @@ module UserMethods
             # Ignore errors sending email
           end
         else
-          current_user.errors.add(:new_email, current_user.errors[:email])
-          current_user.errors.add(:email, [])
+          current_user.errors.delete(:email).each do |error|
+            current_user.errors.add(:new_email, error)
+          end
         end
 
         user.restore_email!