From 50a63a491cca8364af3277b126ecd6140a5ba1c4 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Wed, 27 Jan 2016 23:13:37 +1100
Subject: [PATCH] don't alert for inbox count of 0

---
 .../javascripts/discourse/components/notification-item.js.es6  | 3 ++-
 app/services/post_alerter.rb                                   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/assets/javascripts/discourse/components/notification-item.js.es6 b/app/assets/javascripts/discourse/components/notification-item.js.es6
index 7d18c68c6..6818ba5a3 100644
--- a/app/assets/javascripts/discourse/components/notification-item.js.es6
+++ b/app/assets/javascripts/discourse/components/notification-item.js.es6
@@ -1,4 +1,5 @@
 const INVITED_TYPE = 8;
+const GROUP_SUMMARY_TYPE = 16;
 
 export default Ember.Component.extend({
   tagName: 'li',
@@ -69,7 +70,7 @@ export default Ember.Component.extend({
     const description = this.get('description');
     const username = notification.get('data.display_username');
     var text;
-    if (notification.get('data.inbox_count')) {
+    if (notification.get('notification_type') === GROUP_SUMMARY_TYPE) {
       const count = notification.get('data.inbox_count');
       const group_name = notification.get('data.group_name');
       text = I18n.t(this.get('scope'), {count, group_name});
diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb
index cc3b2809e..7fc06a546 100644
--- a/app/services/post_alerter.rb
+++ b/app/services/post_alerter.rb
@@ -172,7 +172,7 @@ class PostAlerter
                    .pluck(:group_id).first
 
     stat = stats.find{|s| s[:group_id] == group_id}
-    return unless stat
+    return unless stat && stat[:inbox_count] > 0
 
     notification_type = Notification.types[:group_message_summary]