PERF: Remove unnecessary query from `TopicQuery.remove_muted_tags` (#19586)

When `default_tags_muted` site settings has not been set, there is no
need to execute the query.
This commit is contained in:
Alan Guo Xiang Tan 2022-12-23 04:29:17 +08:00 committed by GitHub
parent b756866334
commit a8ee56ebee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -899,7 +899,10 @@ class TopicQuery
muted_tag_ids = TagUser.lookup(user, :muted).pluck(:tag_id)
else
muted_tag_names = SiteSetting.default_tags_muted.split("|")
muted_tag_ids = Tag.where(name: muted_tag_names).pluck(:id)
if muted_tag_names.present?
muted_tag_ids = Tag.where(name: muted_tag_names).pluck(:id)
end
end
if muted_tag_ids.blank?