Commit c81d4a65 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'ce-7472-epics-autocomplete' into 'master'

CE port: Remove instance autocomplete_service variable

See merge request gitlab-org/gitlab-ce!22847
parents c9911621 a68c991c
# 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
......
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