Backport AutocompleteController#load_project
from EE!581.
- This is an optimization that was made in !581, and it needs to be backported to CE to avoid merge conflicts in the future.
This commit is contained in:
parent
0e2cecfd62
commit
2193ae222b
1 changed files with 12 additions and 5 deletions
|
@ -55,11 +55,8 @@ class AutocompleteController < ApplicationController
|
|||
|
||||
def find_users
|
||||
@users =
|
||||
if params[:project_id].present?
|
||||
project = Project.find(params[:project_id])
|
||||
return render_404 unless can?(current_user, :read_project, project)
|
||||
|
||||
project.team.users
|
||||
if @project
|
||||
@project.team.users
|
||||
elsif params[:group_id].present?
|
||||
group = Group.find(params[:group_id])
|
||||
return render_404 unless can?(current_user, :read_group, group)
|
||||
|
@ -71,4 +68,14 @@ class AutocompleteController < ApplicationController
|
|||
User.none
|
||||
end
|
||||
end
|
||||
|
||||
def load_project
|
||||
@project ||= begin
|
||||
if params[:project_id].present?
|
||||
project = Project.find(params[:project_id])
|
||||
return render_404 unless can?(current_user, :read_project, project)
|
||||
project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue