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
79161b95
Commit
79161b95
authored
Feb 15, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e078c1f1
8f209ed5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+7
-3
changelogs/unreleased/rs-admin-user-case-insensitive.yml
changelogs/unreleased/rs-admin-user-case-insensitive.yml
+5
-0
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+11
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
79161b95
# frozen_string_literal: true
class
Admin::UsersController
<
Admin
::
ApplicationController
include
RoutableActions
before_action
:user
,
except:
[
:index
,
:new
,
:create
]
before_action
:check_impersonation_availability
,
only: :impersonate
...
...
@@ -177,11 +179,13 @@ class Admin::UsersController < Admin::ApplicationController
user
==
current_user
end
# rubocop: disable CodeReuse/ActiveRecord
def
user
@user
||=
User
.
find_by!
(
username:
params
[
:id
])
@user
||=
find_routable!
(
User
,
params
[
:id
])
end
def
build_canonical_path
(
user
)
url_for
(
safe_params
.
merge
(
id:
user
.
to_param
))
end
# rubocop: enable CodeReuse/ActiveRecord
def
redirect_back_or_admin_user
(
options
=
{})
redirect_back_or_default
(
default:
default_route
,
options:
options
)
...
...
changelogs/unreleased/rs-admin-user-case-insensitive.yml
0 → 100644
View file @
79161b95
---
title
:
Admin section finds users case-insensitively
merge_request
:
author
:
type
:
fixed
spec/controllers/admin/users_controller_spec.rb
View file @
79161b95
...
...
@@ -8,6 +8,17 @@ describe Admin::UsersController do
sign_in
(
admin
)
end
describe
'GET :id'
do
it
'finds a user case-insensitively'
do
user
=
create
(
:user
,
username:
'CaseSensitive'
)
get
:show
,
params:
{
id:
user
.
username
.
downcase
}
expect
(
response
).
to
be_redirect
expect
(
response
.
location
).
to
end_with
(
user
.
username
)
end
end
describe
'DELETE #user with projects'
do
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
)
}
...
...
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