Commit 79161b95 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents e078c1f1 8f209ed5
# 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)
......
---
title: Admin section finds users case-insensitively
merge_request:
author:
type: fixed
......@@ -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) }
......
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