From 36f36f44287969e62302e0347a01138993068c09 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 4 Sep 2014 14:57:45 +0530 Subject: [PATCH] hide category name for Uncategorized topics while oneboxing --- lib/onebox/engine/discourse_local_onebox.rb | 7 ++++--- lib/onebox/templates/discourse_topic_onebox.handlebars | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/onebox/engine/discourse_local_onebox.rb b/lib/onebox/engine/discourse_local_onebox.rb index 71a3afdcf26..c1976de6091 100644 --- a/lib/onebox/engine/discourse_local_onebox.rb +++ b/lib/onebox/engine/discourse_local_onebox.rb @@ -57,9 +57,10 @@ module Onebox } end + category_name = '' category = topic.category - if category - category = "#{category.name}" + if category && !category.uncategorized? + category_name = "#{category.name}" end quote = post.excerpt(SiteSetting.post_onebox_maxlength) @@ -71,7 +72,7 @@ module Onebox views: topic.views, posters: posters, quote: quote, - category: category, + category_name: 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 42c55b209ca..df209a0d798 100644 --- a/lib/onebox/templates/discourse_topic_onebox.handlebars +++ b/lib/onebox/templates/discourse_topic_onebox.handlebars @@ -2,7 +2,7 @@
{{{avatar}}} - {{title}} {{{category}}} + {{title}} {{{category_name}}}
{{{quote}}}