mirror of
https://github.com/discourse/discourse.git
synced 2025-05-07 04:43:02 +08:00
PERF: Prefer exists?
instead of loading AR object.
This commit is contained in:
parent
50be06af47
commit
9ef61e0af5
@ -655,7 +655,7 @@ SQL
|
|||||||
end
|
end
|
||||||
|
|
||||||
def changed_to_category(new_category)
|
def changed_to_category(new_category)
|
||||||
return true if new_category.blank? || Category.find_by(topic_id: id).present?
|
return true if new_category.blank? || Category.exists?(topic_id: id)
|
||||||
return false if new_category.id == SiteSetting.uncategorized_category_id && !SiteSetting.allow_uncategorized_topics
|
return false if new_category.id == SiteSetting.uncategorized_category_id && !SiteSetting.allow_uncategorized_topics
|
||||||
|
|
||||||
Topic.transaction do
|
Topic.transaction do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user