From 63c4f2431968edc552935ac219a4288c31da9cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sat, 3 May 2014 00:40:57 +0200 Subject: [PATCH] BUGFIX: do not show PMs counters when the value is 0 --- app/assets/javascripts/discourse/models/user.js | 4 ++++ .../javascripts/discourse/templates/user/user.js.handlebars | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/models/user.js b/app/assets/javascripts/discourse/models/user.js index df389e88a75..3e401639a6a 100644 --- a/app/assets/javascripts/discourse/models/user.js +++ b/app/assets/javascripts/discourse/models/user.js @@ -8,6 +8,10 @@ **/ Discourse.User = Discourse.Model.extend({ + hasPMs: Em.computed.gt("private_messages_stats.all", 0), + hasStartedPMs: Em.computed.gt("private_messages_stats.mine", 0), + hasUnreadPMs: Em.computed.gt("private_messages_stats.unread", 0), + /** The user's stream diff --git a/app/assets/javascripts/discourse/templates/user/user.js.handlebars b/app/assets/javascripts/discourse/templates/user/user.js.handlebars index 6f498db37d5..e4d321d1b60 100644 --- a/app/assets/javascripts/discourse/templates/user/user.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/user.js.handlebars @@ -31,21 +31,21 @@
  • {{#link-to 'userPrivateMessages.index' model}} {{i18n user.messages.all}} - ({{private_messages_stats.all}}) + {{#if hasPMs}}({{private_messages_stats.all}}){{/if}} {{/link-to}}
  • {{#link-to 'userPrivateMessages.mine' model}} {{i18n user.messages.mine}} - ({{private_messages_stats.mine}}) + {{#if hasStartedPMs}}({{private_messages_stats.mine}}){{/if}} {{/link-to}}
  • {{#link-to 'userPrivateMessages.unread' model}} {{i18n user.messages.unread}} - ({{private_messages_stats.unread}}) + {{#if hasUnreadPMs}}({{private_messages_stats.unread}}){{/if}} {{/link-to}}