2016-10-12 23:33:09 -04:00
|
|
|
class Projects::AutocompleteSourcesController < Projects::ApplicationController
|
2018-08-09 05:04:12 -04:00
|
|
|
before_action :load_autocomplete_service, except: [:members]
|
2016-10-12 23:33:09 -04:00
|
|
|
|
|
|
|
def members
|
2017-11-27 22:51:03 -05:00
|
|
|
render json: ::Projects::ParticipantsService.new(@project, current_user).execute(target)
|
2016-10-12 23:33:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def issues
|
|
|
|
render json: @autocomplete_service.issues
|
|
|
|
end
|
|
|
|
|
|
|
|
def merge_requests
|
|
|
|
render json: @autocomplete_service.merge_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
def labels
|
2018-07-05 23:37:58 -04:00
|
|
|
render json: @autocomplete_service.labels_as_hash(target)
|
2016-10-12 23:33:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def milestones
|
|
|
|
render json: @autocomplete_service.milestones
|
|
|
|
end
|
|
|
|
|
|
|
|
def commands
|
2017-11-27 22:51:03 -05:00
|
|
|
render json: @autocomplete_service.commands(target, params[:type])
|
2016-10-12 23:33:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def load_autocomplete_service
|
|
|
|
@autocomplete_service = ::Projects::AutocompleteService.new(@project, current_user)
|
|
|
|
end
|
|
|
|
|
2017-11-27 22:51:03 -05:00
|
|
|
def target
|
2018-08-09 05:04:12 -04:00
|
|
|
QuickActions::TargetService
|
|
|
|
.new(project, current_user)
|
|
|
|
.execute(params[:type], params[:type_id])
|
2016-10-12 23:33:09 -04:00
|
|
|
end
|
|
|
|
end
|