summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-03 11:00:51 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-03 11:00:51 +0000
commit4291e28af72890ee4f9c0f306ba691ba84c3435d (patch)
tree980036c1fb0affa984da0c8135d0ffca115baa7c /app/controllers/admin
parent0df317f7297b9a72e888edc09aed51f83414f92a (diff)
parentd386bb780864f4fc36490e19ea654f31bf193d0f (diff)
downloadgitlab-ce-4291e28af72890ee4f9c0f306ba691ba84c3435d.tar.gz
Merge branch 'change-primary-email' into 'master'
Allow primary email to be set to an email that you've already added. Fixes gitlab-com/support-forum#106. When the user sets their primary email to an email that they've already added to their account, this patch makes sure that secondary email record is destroyed, and a new email record is created for the old primary email. This is based on the assumption that in this case no email was meant to be deleted, but the user simply wanted to change which of their emails is primary. See merge request !591
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/users_controller.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index adb83996f8b..d36e359934c 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -102,8 +102,7 @@ class Admin::UsersController < Admin::ApplicationController
email = user.emails.find(params[:email_id])
email.destroy
- user.set_notification_email
- user.save if user.notification_email_changed?
+ user.update_secondary_emails!
respond_to do |format|
format.html { redirect_to :back, notice: "Successfully removed email." }