From 958e7948d193ff839a2803e46c75f52132f54adf Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Wed, 26 Sep 2012 23:59:03 +0200 Subject: [PATCH] ignore more pusher warnings --- assets/javascripts/app/pusher.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/app/pusher.coffee b/assets/javascripts/app/pusher.coffee index c529b9a4..5d7e9ae0 100644 --- a/assets/javascripts/app/pusher.coffee +++ b/assets/javascripts/app/pusher.coffee @@ -1,7 +1,7 @@ Travis.Pusher = -> @active_channels = [] if Travis.config.pusher?.key? - Pusher.warn = @warn + Pusher.warn = @warn.bind(this) @pusher = new Pusher(Travis.config.pusher.key) @subscribe(channel) for channel in Travis.Pusher.CHANNELS this @@ -41,5 +41,9 @@ $.extend Travis.Pusher.prototype, when 'worker:added', 'worker:updated', 'worker:removed' { worker: data } - warn: (type, error) -> - console.warn(error) unless error.data?.message && error.data.message.indexOf('No current subscription') > -1 + warn: (type, warning) -> + console.warn(warning) unless @ignoreWarning(warning) + + ignoreWarning: (warning) -> + if message = warning.data?.message + message.indexOf('Existing subscription') == 0 || message.indexOf('No current subscription') == 0