More efficient query for mentionable users

Signed-off-by: NDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
上级 0cedd703
...@@ -50,7 +50,7 @@ module Mentionable ...@@ -50,7 +50,7 @@ module Mentionable
matches.each do |match| matches.each do |match|
identifier = match.delete "@" identifier = match.delete "@"
if has_project if has_project
id = project.team.members.find { |u| u.username == identifier }.try(:id) id = project.team.members.find_by(username: identifier).try(:id)
else else
id = User.where(username: identifier).pluck(:id).first id = User.where(username: identifier).pluck(:id).first
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册