Commit 37425618 authored by Marin Jankovski's avatar Marin Jankovski

Add option for admin to remove users secondary emails.

parent 73c1030d
...@@ -100,6 +100,16 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -100,6 +100,16 @@ class Admin::UsersController < Admin::ApplicationController
end end
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 protected
def user def user
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
%li %li
%span.light Secondary email: %span.light Secondary email:
%strong= email.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 %li
%span.light Can create groups: %span.light Can create groups:
......
...@@ -68,6 +68,7 @@ Gitlab::Application.routes.draw do ...@@ -68,6 +68,7 @@ Gitlab::Application.routes.draw do
put :team_update put :team_update
put :block put :block
put :unblock put :unblock
delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment