Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-08-06 10:20:41 +0300
committerStan Hu <stanhu@gmail.com>2015-08-06 10:46:14 +0300
commit70f5291808469a808eb2bee70e9e97acc7716bb6 (patch)
treebe9ed5a58663054c584388076ef9a77e65f9b47e /app/controllers/autocomplete_controller.rb
parentcaf4c0dd87ff8c803ed3ed49cda85b29d144668f (diff)
Always add current user to autocomplete controller to support filter by "Me"
Partial fix #2202
Diffstat (limited to 'app/controllers/autocomplete_controller.rb')
-rw-r--r--app/controllers/autocomplete_controller.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb
index 52e9c58b47c..5c3ca8e23c9 100644
--- a/app/controllers/autocomplete_controller.rb
+++ b/app/controllers/autocomplete_controller.rb
@@ -33,6 +33,8 @@ class AutocompleteController < ApplicationController
@users = @users.search(params[:search]) if params[:search].present?
@users = @users.active
@users = @users.page(params[:page]).per(PER_PAGE)
+ # Always include current user if available to filter by "Me"
+ @users = User.find(@users.pluck(:id) + [current_user.id]).uniq if current_user
render json: @users, only: [:name, :username, :id], methods: [:avatar_url]
end