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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c86e311f
Commit
c86e311f
authored
Dec 02, 2020
by
Doug Stull
Committed by
Mark Chao
Dec 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add activate user confirmation modal
- same styling as rest of the admin user actions.
parent
fc5df2d4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
31 deletions
+86
-31
app/helpers/users_helper.rb
app/helpers/users_helper.rb
+14
-1
app/views/admin/users/_user.html.haml
app/views/admin/users/_user.html.haml
+3
-2
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+3
-2
changelogs/unreleased/267118-add-reactivate-user-admin-approval-modal-to-glmodal.yml
...8-add-reactivate-user-admin-approval-modal-to-glmodal.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+12
-3
spec/features/admin/users/user_spec.rb
spec/features/admin/users/user_spec.rb
+16
-2
spec/features/admin/users/users_spec.rb
spec/features/admin/users/users_spec.rb
+33
-21
No files found.
app/helpers/users_helper.rb
View file @
c86e311f
...
...
@@ -129,7 +129,7 @@ module UsersHelper
}
end
def
u
nblock_user_modal
_data
(
user
)
def
u
ser_unblock
_data
(
user
)
{
path:
unblock_admin_user_path
(
user
),
method:
'put'
,
...
...
@@ -168,6 +168,19 @@ module UsersHelper
}
end
def
user_activation_data
(
user
)
{
path:
activate_admin_user_path
(
user
),
method:
'put'
,
modal_attributes:
{
title:
s_
(
'AdminUsers|Activate user %{username}?'
)
%
{
username:
sanitize_name
(
user
.
name
)
},
message:
s_
(
'AdminUsers|You can always deactivate their account again if needed.'
),
okVariant:
'info'
,
okTitle:
s_
(
'AdminUsers|Activate'
)
}.
to_json
}
end
def
user_deactivation_effects
header
=
tag
.
p
s_
(
'AdminUsers|Deactivating a user has the following effects:'
)
...
...
app/views/admin/users/_user.html.haml
View file @
c86e311f
...
...
@@ -40,7 +40,7 @@
%button
.btn.btn-default-tertiary.js-confirm-modal-button
{
data:
user_block_data
(
user
,
user_block_effects
)
}
=
s_
(
'AdminUsers|Block'
)
-
else
%button
.btn.btn-default-tertiary.js-confirm-modal-button
{
data:
u
nblock_user_modal
_data
(
user
)
}
%button
.btn.btn-default-tertiary.js-confirm-modal-button
{
data:
u
ser_unblock
_data
(
user
)
}
=
s_
(
'AdminUsers|Unblock'
)
-
else
%button
.btn.btn-default-tertiary.js-confirm-modal-button
{
data:
user_block_data
(
user
,
user_block_effects
)
}
...
...
@@ -51,7 +51,8 @@
=
s_
(
'AdminUsers|Deactivate'
)
-
elsif
user
.
deactivated?
%li
=
link_to
_
(
'Activate'
),
activate_admin_user_path
(
user
),
method: :put
%button
.btn.btn-default-tertiary.js-confirm-modal-button
{
data:
user_activation_data
(
user
)
}
=
s_
(
'AdminUsers|Activate'
)
-
if
user
.
access_locked?
%li
=
link_to
_
(
'Unlock'
),
unlock_admin_user_path
(
user
),
method: :put
,
data:
{
confirm:
_
(
'Are you sure?'
)
}
...
...
app/views/admin/users/show.html.haml
View file @
c86e311f
...
...
@@ -158,7 +158,8 @@
.card-body
=
render
partial:
'admin/users/user_activation_effects'
%br
=
link_to
'Activate user'
,
activate_admin_user_path
(
@user
),
method: :put
,
class:
"btn gl-button btn-info"
,
data:
{
confirm:
'Are you sure?'
}
%button
.btn.gl-button.btn-info.js-confirm-modal-button
{
data:
user_activation_data
(
@user
)
}
=
s_
(
'AdminUsers|Activate user'
)
-
elsif
@user
.
can_be_deactivated?
.card.border-warning
.card-header.bg-warning.text-white
...
...
@@ -182,7 +183,7 @@
%li
Log in
%li
Access Git repositories
%br
%button
.btn.gl-button.btn-info.js-confirm-modal-button
{
data:
u
nblock_user_modal
_data
(
@user
)
}
%button
.btn.gl-button.btn-info.js-confirm-modal-button
{
data:
u
ser_unblock
_data
(
@user
)
}
=
s_
(
'AdminUsers|Unblock user'
)
-
elsif
!
@user
.
internal?
=
render
'admin/users/block_user'
,
user:
@user
...
...
changelogs/unreleased/267118-add-reactivate-user-admin-approval-modal-to-glmodal.yml
0 → 100644
View file @
c86e311f
---
title
:
Add confirm modal to reactivate user
merge_request
:
48173
author
:
type
:
added
locale/gitlab.pot
View file @
c86e311f
...
...
@@ -1489,9 +1489,6 @@ msgstr ""
msgid "Actions"
msgstr ""
msgid "Activate"
msgstr ""
msgid "Activate Service Desk"
msgstr ""
...
...
@@ -2070,6 +2067,15 @@ msgstr ""
msgid "AdminUsers|Access the API"
msgstr ""
msgid "AdminUsers|Activate"
msgstr ""
msgid "AdminUsers|Activate user"
msgstr ""
msgid "AdminUsers|Activate user %{username}?"
msgstr ""
msgid "AdminUsers|Active"
msgstr ""
...
...
@@ -2259,6 +2265,9 @@ msgstr ""
msgid "AdminUsers|You can always block their account again if needed."
msgstr ""
msgid "AdminUsers|You can always deactivate their account again if needed."
msgstr ""
msgid "AdminUsers|You can always re-activate their account, their data will remain intact."
msgstr ""
...
...
spec/features/admin/users/user_spec.rb
View file @
c86e311f
...
...
@@ -77,8 +77,8 @@ RSpec.describe 'Admin::Users::User' do
end
end
context
'when deactivating the user'
do
it
'shows confirmation and allows
block
ing'
,
:js
do
context
'when deactivating
/re-activating
the user'
do
it
'shows confirmation and allows
deactivating/re-activat
ing'
,
:js
do
visit
admin_user_path
(
user
)
find
(
'button'
,
text:
'Deactivate user'
).
click
...
...
@@ -94,6 +94,20 @@ RSpec.describe 'Admin::Users::User' do
expect
(
page
).
to
have_content
(
'Successfully deactivated'
)
expect
(
page
).
to
have_content
(
'Reactivate this user'
)
find
(
'button'
,
text:
'Activate user'
).
click
wait_for_requests
expect
(
page
).
to
have_content
(
'Activate user'
)
expect
(
page
).
to
have_content
(
'You can always deactivate their account again if needed.'
)
find
(
'.modal-footer button'
,
text:
'Activate'
).
click
wait_for_requests
expect
(
page
).
to
have_content
(
'Successfully activated'
)
expect
(
page
).
to
have_content
(
'Deactivate this user'
)
end
end
...
...
spec/features/admin/users/users_spec.rb
View file @
c86e311f
...
...
@@ -207,11 +207,7 @@ RSpec.describe 'Admin::Users' do
it
'shows confirmation and allows blocking and unblocking'
,
:js
do
expect
(
page
).
to
have_content
(
user
.
email
)
find
(
"[data-testid='user-action-button-
#{
user
.
id
}
']"
).
click
within
find
(
"[data-testid='user-action-dropdown-
#{
user
.
id
}
']"
)
do
find
(
'li button'
,
text:
'Block'
).
click
end
click_action_in_user_dropdown
(
user
.
id
,
'Block'
)
wait_for_requests
...
...
@@ -233,13 +229,7 @@ RSpec.describe 'Admin::Users' do
expect
(
page
).
to
have_content
(
user
.
email
)
find
(
"[data-testid='user-action-button-
#{
user
.
id
}
']"
).
click
within
find
(
"[data-testid='user-action-dropdown-
#{
user
.
id
}
']"
)
do
find
(
'li button'
,
text:
'Unblock'
).
click
end
wait_for_requests
click_action_in_user_dropdown
(
user
.
id
,
'Unblock'
)
expect
(
page
).
to
have_content
(
'Unblock user'
)
expect
(
page
).
to
have_content
(
'You can always block their account again if needed.'
)
...
...
@@ -253,17 +243,11 @@ RSpec.describe 'Admin::Users' do
end
end
context
'when deactivating a user'
do
it
'shows confirmation and allows deactivating'
,
:js
do
context
'when deactivating
/re-activating
a user'
do
it
'shows confirmation and allows deactivating
and re-activating
'
,
:js
do
expect
(
page
).
to
have_content
(
user
.
email
)
find
(
"[data-testid='user-action-button-
#{
user
.
id
}
']"
).
click
within
find
(
"[data-testid='user-action-dropdown-
#{
user
.
id
}
']"
)
do
find
(
'li button'
,
text:
'Deactivate'
).
click
end
wait_for_requests
click_action_in_user_dropdown
(
user
.
id
,
'Deactivate'
)
expect
(
page
).
to
have_content
(
'Deactivate user'
)
expect
(
page
).
to
have_content
(
'Deactivating a user has the following effects'
)
...
...
@@ -276,8 +260,36 @@ RSpec.describe 'Admin::Users' do
expect
(
page
).
to
have_content
(
'Successfully deactivated'
)
expect
(
page
).
not_to
have_content
(
user
.
email
)
click_link
'Deactivated'
wait_for_requests
expect
(
page
).
to
have_content
(
user
.
email
)
click_action_in_user_dropdown
(
user
.
id
,
'Activate'
)
expect
(
page
).
to
have_content
(
'Activate user'
)
expect
(
page
).
to
have_content
(
'You can always deactivate their account again if needed.'
)
find
(
'.modal-footer button'
,
text:
'Activate'
).
click
wait_for_requests
expect
(
page
).
to
have_content
(
'Successfully activated'
)
expect
(
page
).
not_to
have_content
(
user
.
email
)
end
end
def
click_action_in_user_dropdown
(
user_id
,
action
)
find
(
"[data-testid='user-action-button-
#{
user_id
}
']"
).
click
within
find
(
"[data-testid='user-action-dropdown-
#{
user_id
}
']"
)
do
find
(
'li button'
,
text:
action
).
click
end
wait_for_requests
end
end
describe
'GET /admin/users/new'
do
...
...
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