diff --git a/app/assets/javascripts/discourse/views/category-chooser.js.es6 b/app/assets/javascripts/discourse/views/category-chooser.js.es6 index f0e39a8a1d..9f6fc1674f 100644 --- a/app/assets/javascripts/discourse/views/category-chooser.js.es6 +++ b/app/assets/javascripts/discourse/views/category-chooser.js.es6 @@ -9,11 +9,11 @@ export default ComboboxView.extend({ castInteger: true, content: function() { - var scopedCategoryId = this.get('scopedCategoryId'); + let scopedCategoryId = this.get('scopedCategoryId'); // Always scope to the parent of a category, if present if (scopedCategoryId) { - var scopedCat = Discourse.Category.findById(scopedCategoryId); + const scopedCat = Discourse.Category.findById(scopedCategoryId); scopedCategoryId = scopedCat.get('parent_category_id') || scopedCat.get('id'); } @@ -41,13 +41,13 @@ export default ComboboxView.extend({ } }.property(), - template: function(item) { + template(item) { - var category; + let category; // If we have no id, but text with the uncategorized name, we can use that badge. if (Ember.isEmpty(item.id)) { - var uncat = Discourse.Category.findUncategorized(); + const uncat = Discourse.Category.findUncategorized(); if (uncat && uncat.get('name') === item.text) { category = uncat; } @@ -56,15 +56,16 @@ export default ComboboxView.extend({ } if (!category) return item.text; - var result = categoryBadgeHTML(category, {link: false, allowUncategorized: true, hideParent: true}), - parentCategoryId = category.get('parent_category_id'); + let result = categoryBadgeHTML(category, {link: false, allowUncategorized: true, hideParent: true}); + const parentCategoryId = category.get('parent_category_id'); + if (parentCategoryId) { result = categoryBadgeHTML(Discourse.Category.findById(parentCategoryId), {link: false}) + " " + result; } result += " × " + category.get('topic_count') + ""; - var description = category.get('description'); + const description = category.get('description'); // TODO wtf how can this be null?; if (description && description !== 'null') { result += '
' +