diff --git a/lib/onebox/engine/discourse_local_onebox.rb b/lib/onebox/engine/discourse_local_onebox.rb index c1976de6091..6c4bda5fc57 100644 --- a/lib/onebox/engine/discourse_local_onebox.rb +++ b/lib/onebox/engine/discourse_local_onebox.rb @@ -58,9 +58,14 @@ module Onebox end category_name = '' + parent_category_name = '' category = topic.category if category && !category.uncategorized? category_name = "#{category.name}" + if !category.parent_category_id.nil? + parent_category = Category.find_by(id: category.parent_category_id) + parent_category_name = "#{parent_category.name}" + end end quote = post.excerpt(SiteSetting.post_onebox_maxlength) @@ -73,6 +78,7 @@ module Onebox posters: posters, quote: quote, category_name: category_name, + parent_category_name: parent_category_name, topic: topic.id @template = 'topic' diff --git a/lib/onebox/templates/discourse_topic_onebox.handlebars b/lib/onebox/templates/discourse_topic_onebox.handlebars index df209a0d798..2446ec6a9a2 100644 --- a/lib/onebox/templates/discourse_topic_onebox.handlebars +++ b/lib/onebox/templates/discourse_topic_onebox.handlebars @@ -2,7 +2,7 @@
{{{quote}}}