Don't show tags label if there are no tags to show

This commit is contained in:
Toby Zerner 2015-06-15 12:16:41 +09:30
parent bec1f73c36
commit d5b1d3bdb2

View File

@ -10,8 +10,11 @@ export default function() {
// Add tag labels to each discussion in the discussion list. // Add tag labels to each discussion in the discussion list.
extend(DiscussionList.prototype, 'infoItems', function(items, discussion) { extend(DiscussionList.prototype, 'infoItems', function(items, discussion) {
var tags = discussion.tags(); var tags = discussion.tags();
if (tags && tags.length) { if (tags) {
items.add('tags', tagsLabel(tags.filter(tag => tag.slug() !== this.props.params.tags)), {first: true}); tags = tags.filter(tag => tag.slug() !== this.props.params.tags);
if (tags.length) {
items.add('tags', tagsLabel(tags), {first: true});
}
} }
}); });