From 5ec25ff3e1c53a4feab1e9b9a3f1660cca538c23 Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Fri, 5 Jan 2018 00:15:35 +0100 Subject: Fix email confirmation link not updating email (#6187) A change introduced in #6125 prevents `Devise::Models::Confirmable#confirm` from being called for existing users, which in turn leads to `email` not being set to `unconfirmed_email`, breaking email updates. This also adds a test that would've caught this issue. --- app/models/user.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index a82a7d28a..9459db7fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -126,18 +126,18 @@ class User < ApplicationRecord end def confirm - return if confirmed? + new_user = !confirmed? super - update_statistics! + update_statistics! if new_user end def confirm! - return if confirmed? + new_user = !confirmed? skip_confirmation! save! - update_statistics! + update_statistics! if new_user end def promote! -- cgit