Merge branch 'ce-7472-epics-autocomplete' into 'master'
CE port: Remove instance autocomplete_service variable See merge request gitlab-org/gitlab-ce!22847
This commit is contained in:
commit
c81d4a65a2
1 changed files with 8 additions and 10 deletions
|
@ -1,40 +1,38 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Projects::AutocompleteSourcesController < Projects::ApplicationController
|
class Projects::AutocompleteSourcesController < Projects::ApplicationController
|
||||||
before_action :load_autocomplete_service, except: [:members]
|
|
||||||
|
|
||||||
def members
|
def members
|
||||||
render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target)
|
render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target)
|
||||||
end
|
end
|
||||||
|
|
||||||
def issues
|
def issues
|
||||||
render json: @autocomplete_service.issues
|
render json: autocomplete_service.issues
|
||||||
end
|
end
|
||||||
|
|
||||||
def merge_requests
|
def merge_requests
|
||||||
render json: @autocomplete_service.merge_requests
|
render json: autocomplete_service.merge_requests
|
||||||
end
|
end
|
||||||
|
|
||||||
def labels
|
def labels
|
||||||
render json: @autocomplete_service.labels_as_hash(target)
|
render json: autocomplete_service.labels_as_hash(target)
|
||||||
end
|
end
|
||||||
|
|
||||||
def milestones
|
def milestones
|
||||||
render json: @autocomplete_service.milestones
|
render json: autocomplete_service.milestones
|
||||||
end
|
end
|
||||||
|
|
||||||
def commands
|
def commands
|
||||||
render json: @autocomplete_service.commands(target, params[:type])
|
render json: autocomplete_service.commands(target, params[:type])
|
||||||
end
|
end
|
||||||
|
|
||||||
def snippets
|
def snippets
|
||||||
render json: @autocomplete_service.snippets
|
render json: autocomplete_service.snippets
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_autocomplete_service
|
def autocomplete_service
|
||||||
@autocomplete_service = ::Projects::AutocompleteService.new(@project, current_user)
|
@autocomplete_service ||= ::Projects::AutocompleteService.new(@project, current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def target
|
def target
|
||||||
|
|
Loading…
Reference in a new issue