mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 15:23:54 +08:00
16 lines
362 B
Ruby
16 lines
362 B
Ruby
|
module SuggestedTopicsMixin
|
||
|
def self.included(klass)
|
||
|
klass.attributes :suggested_topics
|
||
|
end
|
||
|
|
||
|
def include_suggested_topics?
|
||
|
object.next_page.nil? && object.suggested_topics&.topics.present?
|
||
|
end
|
||
|
|
||
|
def suggested_topics
|
||
|
object.suggested_topics.topics.map do |t|
|
||
|
SuggestedTopicSerializer.new(t, scope: scope, root: false)
|
||
|
end
|
||
|
end
|
||
|
end
|