summaryrefslogtreecommitdiff
path: root/app/controllers/autocomplete_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/autocomplete_controller.rb')
-rw-r--r--app/controllers/autocomplete_controller.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb
index 0df201ab506..99fa17e202a 100644
--- a/app/controllers/autocomplete_controller.rb
+++ b/app/controllers/autocomplete_controller.rb
@@ -4,10 +4,6 @@ class AutocompleteController < ApplicationController
skip_before_action :authenticate_user!, only: [:users, :award_emojis, :merge_request_target_branches]
def users
- project = Autocomplete::ProjectFinder
- .new(current_user, params)
- .execute
-
group = Autocomplete::GroupFinder
.new(current_user, project, params)
.execute
@@ -50,8 +46,20 @@ class AutocompleteController < ApplicationController
end
end
+ def deploy_keys_with_owners
+ deploy_keys = DeployKeys::CollectKeysService.new(project, current_user).execute
+
+ render json: DeployKeySerializer.new.represent(deploy_keys, { with_owner: true, user: current_user })
+ end
+
private
+ def project
+ @project ||= Autocomplete::ProjectFinder
+ .new(current_user, params)
+ .execute
+ end
+
def target_branch_params
params.permit(:group_id, :project_id).select { |_, v| v.present? }
end