diff options
author | Sean McGivern <sean@gitlab.com> | 2016-07-13 17:38:21 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-07-27 16:10:49 +0300 |
commit | dc4de2d8e2a42640cc24816fd28112c2f2d0bc91 (patch) | |
tree | 31b0b71bbf9cc0130fb3f7577af3d6fc9df8c152 /app/controllers/autocomplete_controller.rb | |
parent | aed644ccc084223cb1f9c5d955569c5ff9eeaf88 (diff) |
Allow skipping users in autocomplete
Pass an array of user IDs in the `skip_users` param to have them
excluded from the results (unless they are explicitly included through
the `current_user` or `author_id` params).
Diffstat (limited to 'app/controllers/autocomplete_controller.rb')
-rw-r--r-- | app/controllers/autocomplete_controller.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index c89678cf2d8..d828d163c28 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -5,6 +5,7 @@ class AutocompleteController < ApplicationController def users @users ||= User.none @users = @users.search(params[:search]) if params[:search].present? + @users = @users.where.not(id: params[:skip_users]) if params[:skip_users].present? @users = @users.active @users = @users.reorder(:name) @users = @users.page(params[:page]) |