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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.7 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]
2023-03-17 16:20:25 +05:30
feature_category :code_review_workflow, [:merge_requests]
2021-06-08 01:23:25 +05:30
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
2023-04-23 21:23:45 +05:30
# TODO https://gitlab.com/gitlab-org/gitlab/-/issues/388541
# type_id is a misnomer. QuickActions::TargetService actually requires an iid.
2021-06-08 01:23:25 +05:30
QuickActions::TargetService
.new(nil, current_user, group: @group)
.execute(params[:type], params[:type_id])
end
# rubocop: enable CodeReuse/ActiveRecord
end
Groups::AutocompleteSourcesController.prepend_mod