diff --git a/app/assets/javascripts/discourse/components/d-link.js.es6 b/app/assets/javascripts/discourse/components/d-link.js.es6 index bde5d654a5a..79a55a9fefc 100644 --- a/app/assets/javascripts/discourse/components/d-link.js.es6 +++ b/app/assets/javascripts/discourse/components/d-link.js.es6 @@ -58,7 +58,8 @@ export default Ember.Component.extend({ if (label) { if (icon) { buffer.push(" "); } - buffer.push(I18n.t(label)); + const count = this.get('count'); + buffer.push(I18n.t(label, { count })); } } diff --git a/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 b/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 index 903c705c61c..d3b5cc57a68 100644 --- a/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 +++ b/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 @@ -22,6 +22,26 @@ export default Ember.Component.extend({ return this.siteSettings.faq_url ? this.siteSettings.faq_url : Discourse.getURL('/faq'); }, + @computed() + topicTrackingState() { + return Discourse.TopicTrackingState.current(); + }, + + _lookupCount(type) { + const state = this.get('topicTrackingState'); + return state ? state.lookupCount(type) : 0; + }, + + @computed('topicTrackingState.messageCount') + newCount() { + return this._lookupCount('new'); + }, + + @computed('topicTrackingState.messageCount') + unreadCount() { + return this._lookupCount('unread'); + }, + @computed() categories() { const hideUncategorized = !this.siteSettings.allow_uncategorized_topics; diff --git a/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs b/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs index 65d5debbe3a..afeb60bc450 100644 --- a/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs +++ b/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs @@ -31,8 +31,12 @@
  • {{d-link route="discovery.latest" class="latest-topics-link" label="filters.latest.title.zero"}}
  • {{#if currentUser}} -
  • {{d-link route="discovery.new" class="new-topics-link" label="filters.new.title.zero"}}
  • -
  • {{d-link route="discovery.unread" class="unread-topics-link" label="filters.unread.title.zero"}}
  • +
  • + {{d-link route="discovery.new" class="new-topics-link" label="filters.new.title" count=newCount}} +
  • +
  • + {{d-link route="discovery.unread" class="unread-topics-link" label="filters.unread.title" count=unreadCount}} +
  • {{/if}}
  • {{d-link route="discovery.top" class="top-topics-link" label="filters.top.title"}}