debian-mirror-gitlab/app/controllers/groups/autocomplete_sources_controller.rb

57 lines
1.5 KiB
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
class Groups::AutocompleteSourcesController < Groups::ApplicationController
feature_category :subgroups, [:members]
2021-12-11 22:18:48 +05:30
feature_category :team_planning, [:issues, :labels, :milestones, :commands]
2021-06-08 01:23:25 +05:30
feature_category :code_review, [:merge_requests]
2022-07-23 23:45:48 +05:30
urgency :low, [:issues, :labels, :milestones, :commands, :merge_requests, :members]
2022-01-26 12:08:38 +05:30
2021-06-08 01:23:25 +05:30
def members
render json: ::Groups::ParticipantsService.new(@group, current_user).execute(target)
end
def issues
render json: issuable_serializer.represent(
autocomplete_service.issues(confidential_only: params[:confidential_only], issue_types: params[:issue_types]),
parent_group: @group
)
end
def merge_requests
render json: issuable_serializer.represent(autocomplete_service.merge_requests, parent_group: @group)
end
def labels
render json: autocomplete_service.labels_as_hash(target)
end
def commands
render json: autocomplete_service.commands(target)
end
def milestones
render json: autocomplete_service.milestones
end
private
def autocomplete_service
@autocomplete_service ||= ::Groups::AutocompleteService.new(@group, current_user, params)
end
def issuable_serializer
GroupIssuableAutocompleteSerializer.new
end
# rubocop: disable CodeReuse/ActiveRecord
def target
QuickActions::TargetService
.new(nil, current_user, group: @group)
.execute(params[:type], params[:type_id])
end
# rubocop: enable CodeReuse/ActiveRecord
end
Groups::AutocompleteSourcesController.prepend_mod