Commit dd52915d authored by Yorick Peterse's avatar Yorick Peterse

Don't pluck IDs in AutocompleteUsersFinder

We can instead just use a UNION. This removes the need for plucking
hundreds if not thousands of IDs into memory when a project has many
members.
parent f330f659
...@@ -52,9 +52,13 @@ class AutocompleteUsersFinder ...@@ -52,9 +52,13 @@ class AutocompleteUsersFinder
end end
def users_from_project def users_from_project
user_ids = project.team.users.pluck(:id) if author_id.present?
user_ids << author_id if author_id.present? union = Gitlab::SQL::Union
.new([project.team.users, User.where(id: author_id)])
User.where(id: user_ids) User.from("(#{union.to_sql}) #{User.table_name}")
else
project.authorized_users
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment