Commit 5e699c98 authored by Mark Chao's avatar Mark Chao

Add autocomplete_sources/epics endpoint

Add epics path to autocomplete_data_sources
parent 05ad2887
......@@ -90,6 +90,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resources :autocomplete_sources, only: [] do
collection do
get 'members'
get 'epics'
end
end
......
class Groups::AutocompleteSourcesController < Groups::ApplicationController
before_action :load_autocomplete_service, except: [:members]
def members
render json: ::Groups::ParticipantsService.new(@group, current_user).execute(target)
end
def epics
render json: @autocomplete_service.epics
end
private
def load_autocomplete_service
@autocomplete_service = ::Groups::AutocompleteService.new(@group, current_user)
end
def target
case params[:type]&.downcase
when 'epic'
......
......@@ -66,7 +66,8 @@ module EE
return super unless object.is_a?(Group)
{
members: members_group_autocomplete_sources_path(object, type: noteable_type, type_id: params[:id])
members: members_group_autocomplete_sources_path(object, type: noteable_type, type_id: params[:id]),
epics: epics_group_autocomplete_sources_path(object)
}
end
......
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