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
8e8c0dbb
Commit
8e8c0dbb
authored
May 12, 2021
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for unban and ff disabled
Apply MR review suggestions Add version history
parent
f1b1e1df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
9 deletions
+39
-9
doc/user/admin_area/moderate_users.md
doc/user/admin_area/moderate_users.md
+2
-0
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+37
-9
No files found.
doc/user/admin_area/moderate_users.md
View file @
8e8c0dbb
...
...
@@ -119,6 +119,8 @@ A deactivated user can also activate their account themselves by logging back in
## Ban and unban users
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/327353) in GitLab 13.12.
GitLab administrators can ban users.
NOTE:
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
8e8c0dbb
...
...
@@ -366,6 +366,7 @@ RSpec.describe Admin::UsersController do
end
describe
'PUT ban/:id'
do
context
'when ban_user_feature_flag is enabled'
do
it
'bans user'
do
put
:ban
,
params:
{
id:
user
.
username
}
...
...
@@ -387,6 +388,33 @@ RSpec.describe Admin::UsersController do
end
end
context
'when ban_user_feature_flag is not enabled'
do
before
do
stub_feature_flags
(
ban_user_feature_flag:
false
)
end
it
'does not ban user, renders 404'
do
put
:ban
,
params:
{
id:
user
.
username
}
user
.
reload
expect
(
user
.
banned?
).
to
be_falsey
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
describe
'PUT unban/:id'
do
let
(
:banned_user
)
{
create
(
:user
,
:banned
)
}
it
'unbans user'
do
put
:unban
,
params:
{
id:
banned_user
.
username
}
banned_user
.
reload
expect
(
banned_user
.
banned?
).
to
be_falsey
expect
(
flash
[
:notice
]).
to
eq
_
(
'Successfully unbanned'
)
end
end
describe
'PUT unlock/:id'
do
before
do
request
.
env
[
"HTTP_REFERER"
]
=
"/"
...
...
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