PERF: Don't join on shared drafts unless you have to

This commit is contained in:
Robin Ward
2018-03-28 13:57:20 -04:00
parent fa608f2bb4
commit efedd9745f
5 changed files with 47 additions and 22 deletions

View File

@ -71,7 +71,10 @@ class ListController < ApplicationController
list = TopicQuery.new(user, list_opts).public_send("list_#{filter}")
if @category.present? && guardian.can_create_shared_draft?
if @category.present? &&
guardian.can_create_shared_draft? &&
@category.id != SiteSetting.shared_drafts_category.to_i
shared_drafts = TopicQuery.new(
user,
category: SiteSetting.shared_drafts_category,