diff options
author | Stan Hu <stanhu@gmail.com> | 2015-08-06 00:20:41 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-08-06 00:46:14 -0700 |
commit | 70f5291808469a808eb2bee70e9e97acc7716bb6 (patch) | |
tree | be9ed5a58663054c584388076ef9a77e65f9b47e /app/controllers/autocomplete_controller.rb | |
parent | caf4c0dd87ff8c803ed3ed49cda85b29d144668f (diff) | |
download | gitlab-ce-70f5291808469a808eb2bee70e9e97acc7716bb6.tar.gz |
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.rb | 2 |
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 |