diff options
| author | Hiroyuki Sato <sathiroyuki@gmail.com> | 2019-03-09 12:22:58 +0000 |
|---|---|---|
| committer | Nick Thomas <nick@gitlab.com> | 2019-03-09 12:22:58 +0000 |
| commit | de784ac10516ec1e1c93d164f3d99b2ff09e5889 (patch) | |
| tree | fd3e0a4d845545f2ffa72e82294394a2139a4e50 /app/controllers/autocomplete_controller.rb | |
| parent | 6908c5f70eb4d5d7e8ef28b43d73d71da9b2a0c3 (diff) | |
| download | gitlab-ce-de784ac10516ec1e1c93d164f3d99b2ff09e5889.tar.gz | |
Filter merge requests by target branch
Diffstat (limited to 'app/controllers/autocomplete_controller.rb')
| -rw-r--r-- | app/controllers/autocomplete_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 0d5c8657c9e..091327931c2 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class AutocompleteController < ApplicationController - skip_before_action :authenticate_user!, only: [:users, :award_emojis] + skip_before_action :authenticate_user!, only: [:users, :award_emojis, :merge_request_target_branches] def users project = Autocomplete::ProjectFinder @@ -38,4 +38,11 @@ class AutocompleteController < ApplicationController def award_emojis render json: AwardedEmojiFinder.new(current_user).execute end + + def merge_request_target_branches + merge_requests = MergeRequestsFinder.new(current_user, params).execute + target_branches = merge_requests.recent_target_branches + + render json: target_branches.map { |target_branch| { title: target_branch } } + end end |
