Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
550f2337
Commit
550f2337
authored
Jun 23, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove_secondary_user_email' into 'master'
Remove secondary user email Fixes #1286
parents
08e4be01
d12c1e90
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
0 deletions
+40
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+10
-0
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+2
-0
config/routes.rb
config/routes.rb
+1
-0
features/admin/users.feature
features/admin/users.feature
+8
-0
features/steps/admin/users.rb
features/steps/admin/users.rb
+19
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
550f2337
...
...
@@ -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
...
...
app/views/admin/users/show.html.haml
View file @
550f2337
...
...
@@ -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'
,
id:
"remove_email_
#{
email
.
id
}
"
do
%i
.icon-remove
%li
%span
.light
Can create groups:
...
...
config/routes.rb
View file @
550f2337
...
...
@@ -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
...
...
features/admin/users.feature
View file @
550f2337
...
...
@@ -21,3 +21,11 @@ Feature: Admin Users
And
click edit on my user
When
I submit modified user
Then
I see user attributes changed
@javascript
Scenario
:
Remove users secondary email
Given
I visit admin users page
And
I view the user with secondary email
And
I see the secondary email
When
I click remove secondary email
Then
I should not see secondary email anymore
features/steps/admin/users.rb
View file @
550f2337
...
...
@@ -44,4 +44,23 @@ class AdminUsers < Spinach::FeatureSteps
step
'click edit on my user'
do
find
(
"#edit_user_
#{
current_user
.
id
}
"
).
click
end
step
'I view the user with secondary email'
do
@user_with_secondary_email
=
User
.
last
@user_with_secondary_email
.
emails
.
new
(
email:
"secondary@example.com"
)
@user_with_secondary_email
.
save
visit
"/admin/users/
#{
@user_with_secondary_email
.
username
}
"
end
step
'I see the secondary email'
do
page
.
should
have_content
"Secondary email:
#{
@user_with_secondary_email
.
emails
.
last
.
email
}
"
end
step
'I click remove secondary email'
do
find
(
"#remove_email_
#{
@user_with_secondary_email
.
emails
.
last
.
id
}
"
).
click
end
step
'I should not see secondary email anymore'
do
page
.
should_not
have_content
"Secondary email:"
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment