mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
Revert "PERF: Don't join on shared drafts unless you have to"
This reverts commit efedd9745fd9c34ac982941cca79f8ab8e517328.
This commit is contained in:
@ -9,26 +9,12 @@ class TopicListSerializer < ApplicationSerializer
|
||||
:per_page,
|
||||
:top_tags,
|
||||
:tags,
|
||||
:shared_drafts,
|
||||
:topics
|
||||
:shared_drafts
|
||||
|
||||
has_many :topics, serializer: TopicListItemSerializer, embed: :objects
|
||||
has_many :shared_drafts, serializer: TopicListItemSerializer, embed: :objects
|
||||
has_many :tags, serializer: TagSerializer, embed: :objects
|
||||
|
||||
def topics
|
||||
object.topics.map do |t|
|
||||
serializer = TopicListItemSerializer.new(t, scope: scope, root: false)
|
||||
|
||||
if scope.can_create_shared_draft? &&
|
||||
object.category&.id == SiteSetting.shared_drafts_category.to_i
|
||||
|
||||
serializer.include_destination_category = true
|
||||
end
|
||||
|
||||
serializer
|
||||
end
|
||||
end
|
||||
|
||||
def can_create_topic
|
||||
scope.can_create?(Topic)
|
||||
end
|
||||
|
Reference in New Issue
Block a user