summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-06-23 09:45:26 +0200
committerMarin Jankovski <marin@gitlab.com>2014-06-23 09:45:26 +0200
commit37425618bc5a15bb58ed6695d4932d309d452cb2 (patch)
treebe97eabfb404aeb181e525a2df07a87ebce907ba
parent73c1030da1318284495288461210e8d145aa7181 (diff)
downloadgitlab-ce-37425618bc5a15bb58ed6695d4932d309d452cb2.tar.gz
Add option for admin to remove users secondary emails.
-rw-r--r--app/controllers/admin/users_controller.rb10
-rw-r--r--app/views/admin/users/show.html.haml2
-rw-r--r--config/routes.rb1
3 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 5ecdfbd807e..f0040bf5e87 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -100,6 +100,16 @@ class Admin::UsersController < Admin::ApplicationController
end
end
+ def remove_email
+ email = user.emails.find(params[:email_id])
+ email.destroy
+
+ respond_to do |format|
+ format.html { redirect_to :back, notice: "Successfully removed email." }
+ format.js { render nothing: true }
+ end
+ end
+
protected
def user
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index a255c64fc27..0afae987a39 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -44,6 +44,8 @@
%li
%span.light Secondary email:
%strong= email.email
+ = link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-tiny btn btn-remove pull-right", title: 'Remove secondary email' do
+ %i.icon-remove
%li
%span.light Can create groups:
diff --git a/config/routes.rb b/config/routes.rb
index 779cbad709c..5b854ed20b9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -68,6 +68,7 @@ Gitlab::Application.routes.draw do
put :team_update
put :block
put :unblock
+ delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
end
end