summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-01-27 16:58:22 +0000
committerRobert Speicher <rspeicher@gmail.com>2017-01-27 14:12:29 -0500
commitbb069b39a25f09fcb898500ce7b29ae936392ce8 (patch)
treec4fa7a714a54495c2ef9b550dd24f051dfb8e99a
parent6bece889b3784867e1b8cbb566d2d8343312cf55 (diff)
downloadgitlab-ce-bb069b39a25f09fcb898500ce7b29ae936392ce8.tar.gz
Merge branch 'speed-up-members-dropdown' into 'master'
Don't call `#uniq` on a relation See merge request !8784
-rw-r--r--app/controllers/autocomplete_controller.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb
index 6db4e1dc1bc..d7a45bacd35 100644
--- a/app/controllers/autocomplete_controller.rb
+++ b/app/controllers/autocomplete_controller.rb
@@ -18,15 +18,14 @@ class AutocompleteController < ApplicationController
if params[:search].blank?
# Include current user if available to filter by "Me"
if params[:current_user].present? && current_user
+ @users = @users.where.not(id: current_user.id)
@users = [current_user, *@users]
end
if params[:author_id].present?
author = User.find_by_id(params[:author_id])
- @users = [author, *@users] if author
+ @users = [author, *@users].uniq if author
end
-
- @users.uniq!
end
render json: @users, only: [:name, :username, :id], methods: [:avatar_url]