mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 11:52:45 +08:00
PERF: Avoid loading the whole record when we only need id (#25301)
This commit is contained in:
parent
26698ff52a
commit
20c5f7aef8
|
@ -161,7 +161,7 @@ module Jobs
|
|||
target_id = user_id
|
||||
elsif mention_klass == ::Chat::GroupMention
|
||||
begin
|
||||
target_id = Group.where("LOWER(name) = ?", "#{mention_type}").first.id
|
||||
target_id = Group.where("LOWER(name) = ?", "#{mention_type}").pick(:id)
|
||||
rescue => e
|
||||
Discourse.warn_exception(e, message: "Mentioned group doesn't exist")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user