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