mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
PERF: Avoid loading the whole record when we only need id (#25301)
This commit is contained in:

committed by
GitHub

parent
26698ff52a
commit
20c5f7aef8
@ -161,7 +161,7 @@ module Jobs
|
|||||||
target_id = user_id
|
target_id = user_id
|
||||||
elsif mention_klass == ::Chat::GroupMention
|
elsif mention_klass == ::Chat::GroupMention
|
||||||
begin
|
begin
|
||||||
target_id = Group.where("LOWER(name) = ?", "#{mention_type}").first.id
|
target_id = Group.where("LOWER(name) = ?", "#{mention_type}").pick(:id)
|
||||||
rescue => e
|
rescue => e
|
||||||
Discourse.warn_exception(e, message: "Mentioned group doesn't exist")
|
Discourse.warn_exception(e, message: "Mentioned group doesn't exist")
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user