diff options
author | Jarka Košanová <jarka@gitlab.com> | 2018-11-01 11:57:09 +0300 |
---|---|---|
committer | Jarka Košanová <jarka@gitlab.com> | 2018-11-06 19:24:44 +0300 |
commit | a68c991c3231696b441271578bc54c7bc7839f63 (patch) | |
tree | c991fcccd5266465eacd8cb89253fff28e746b04 /app/controllers | |
parent | d0c58a97c8a053c0beec7c13c1c6ec5042120ef1 (diff) |
Remove instance autocomplete_service variable
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/autocomplete_sources_controller.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/controllers/projects/autocomplete_sources_controller.rb b/app/controllers/projects/autocomplete_sources_controller.rb index d386fb63d9f..9c130af8394 100644 --- a/app/controllers/projects/autocomplete_sources_controller.rb +++ b/app/controllers/projects/autocomplete_sources_controller.rb @@ -1,40 +1,38 @@ # frozen_string_literal: true class Projects::AutocompleteSourcesController < Projects::ApplicationController - before_action :load_autocomplete_service, except: [:members] - def members render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target) end def issues - render json: @autocomplete_service.issues + render json: autocomplete_service.issues end def merge_requests - render json: @autocomplete_service.merge_requests + render json: autocomplete_service.merge_requests end def labels - render json: @autocomplete_service.labels_as_hash(target) + render json: autocomplete_service.labels_as_hash(target) end def milestones - render json: @autocomplete_service.milestones + render json: autocomplete_service.milestones end def commands - render json: @autocomplete_service.commands(target, params[:type]) + render json: autocomplete_service.commands(target, params[:type]) end def snippets - render json: @autocomplete_service.snippets + render json: autocomplete_service.snippets end private - def load_autocomplete_service - @autocomplete_service = ::Projects::AutocompleteService.new(@project, current_user) + def autocomplete_service + @autocomplete_service ||= ::Projects::AutocompleteService.new(@project, current_user) end def target |