A platform for community discussion. Free, open, simple.
PERF: Avoid loading the whole record when we only need id (#25301)
Andrei Prigorshnev20c5f7aef89b
diff --git a/plugins/chat/app/jobs/regular/chat/notify_mentioned.rb b/plugins/chat/app/jobs/regular/chat/notify_mentioned.rbindex 9e101aa53b4..5b472be3cd7 100644--- a/plugins/chat/app/jobs/regular/chat/notify_mentioned.rb+++ b/plugins/chat/app/jobs/regular/chat/notify_mentioned.rb@@ -161,7 +161,7 @@ module Jobstarget_id = user_idelsif mention_klass == ::Chat::GroupMentionbegin- target_id = Group.where("LOWER(name) = ?", "#{mention_type}").first.id+ target_id = Group.where("LOWER(name) = ?", "#{mention_type}").pick(:id)rescue => eDiscourse.warn_exception(e, message: "Mentioned group doesn't exist")end