Commit 181aa2b9160347ad23de3ef1e6f5ce45234261e1

Authored by Dmitriy Zaporozhets
1 parent 0cedd703

More efficient query for mentionable users

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/concerns/mentionable.rb
... ... @@ -50,7 +50,7 @@ module Mentionable
50 50 matches.each do |match|
51 51 identifier = match.delete "@"
52 52 if has_project
53   - id = project.team.members.find { |u| u.username == identifier }.try(:id)
  53 + id = project.team.members.find_by(username: identifier).try(:id)
54 54 else
55 55 id = User.where(username: identifier).pluck(:id).first
56 56 end
... ...