mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
PERF: avoid filtering shared drafts when not used
In some very specific cases (large sites) shared drafts can introduce a performance hit due to the mechanism used to filter out topics This avoids the entire process when shared drafts are not enabled
This commit is contained in:
parent
7e10c4b83f
commit
0d5d478146
1 changed files with 5 additions and 0 deletions
|
@ -591,6 +591,11 @@ class TopicQuery
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_shared_drafts(result, category_id, options)
|
def apply_shared_drafts(result, category_id, options)
|
||||||
|
|
||||||
|
# PERF: avoid any penalty if there are no shared drafts enabled
|
||||||
|
# on some sites the cost can be high eg: gearbox
|
||||||
|
return result if SiteSetting.shared_drafts_category == ""
|
||||||
|
|
||||||
drafts_category_id = SiteSetting.shared_drafts_category.to_i
|
drafts_category_id = SiteSetting.shared_drafts_category.to_i
|
||||||
viewing_shared = category_id && category_id == drafts_category_id
|
viewing_shared = category_id && category_id == drafts_category_id
|
||||||
can_create_shared = guardian.can_create_shared_draft?
|
can_create_shared = guardian.can_create_shared_draft?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue