Fix application crashes after #2772
This commit is contained in:
parent
71e89df5e0
commit
0125b74b3c
2 changed files with 6 additions and 7 deletions
|
@ -1,4 +1,6 @@
|
|||
class Admin::UsersController < Admin::ApplicationController
|
||||
before_filter :admin_user, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@admin_users = User.scoped
|
||||
@admin_users = @admin_users.filter(params[:filter])
|
||||
|
@ -7,11 +9,8 @@ class Admin::UsersController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
projects = if admin_user.authorized_projects.empty?
|
||||
Project
|
||||
else
|
||||
Project.without_user(admin_user)
|
||||
end.all
|
||||
@projects = Project.scoped
|
||||
@projects = @projects.without_user(admin_user) if admin_user.authorized_projects.empty?
|
||||
end
|
||||
|
||||
def team_update
|
||||
|
@ -102,6 +101,6 @@ class Admin::UsersController < Admin::ApplicationController
|
|||
protected
|
||||
|
||||
def admin_user
|
||||
@admin_user ||= User.find_by_username(params[:id])
|
||||
@admin_user ||= User.find_by_username!(params[:id])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ Gitlab::Application.routes.draw do
|
|||
# Admin Area
|
||||
#
|
||||
namespace :admin do
|
||||
resources :users do
|
||||
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
|
||||
member do
|
||||
put :team_update
|
||||
put :block
|
||||
|
|
Loading…
Reference in a new issue