mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 14:19:49 +08:00
e17a13ce19
This splits out previous message correspondence from suggeted and instead has a dedicated section called "related messages"
27 lines
659 B
Ruby
27 lines
659 B
Ruby
module SuggestedTopicsMixin
|
|
def self.included(klass)
|
|
klass.attributes :related_messages
|
|
klass.attributes :suggested_topics
|
|
end
|
|
|
|
def include_related_messages?
|
|
object.next_page.nil? && object.related_messages&.topics.present?
|
|
end
|
|
|
|
def include_suggested_topics?
|
|
object.next_page.nil? && object.suggested_topics&.topics.present?
|
|
end
|
|
|
|
def related_messages
|
|
object.related_messages.topics.map do |t|
|
|
SuggestedTopicSerializer.new(t, scope: scope, root: false)
|
|
end
|
|
end
|
|
|
|
def suggested_topics
|
|
object.suggested_topics.topics.map do |t|
|
|
SuggestedTopicSerializer.new(t, scope: scope, root: false)
|
|
end
|
|
end
|
|
end
|