From 3f64173905a9c4f91a071caf358910a5423a13b6 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 8 Mar 2014 22:44:28 +0100 Subject: [PATCH] Don't trigger toasts on init --- .../core/notifications/core/static/notification.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index 717fbf11..2cd4fff1 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -103,7 +103,9 @@ var NotificationBase = new Class({ self.request = Api.request('notification.listener', { 'data': {'init':true}, - 'onSuccess': self.processData.bind(self) + 'onSuccess': function(json){ + self.processData(json, true) + } }).send() setInterval(function(){ @@ -124,7 +126,9 @@ var NotificationBase = new Class({ return; self.request = Api.request('nonblock/notification.listener', { - 'onSuccess': self.processData.bind(self), + 'onSuccess': function(json){ + self.processData(json, false) + }, 'data': { 'last_id': self.last_id }, @@ -141,14 +145,14 @@ var NotificationBase = new Class({ this.stopped = true; }, - processData: function(json){ + processData: function(json, init){ var self = this; // Process data if(json){ Array.each(json.result, function(result){ App.trigger(result._t || result.type, [result]); - if(result.message && result.read === undefined) + if(result.message && result.read === undefined && !init) self.showMessage(result.message); })