From 90b91bd49b6d154f8e44b8638c36865c40fc57b1 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 3 Feb 2015 19:14:47 +0100 Subject: [PATCH] Fix pusher channel subscribe When channel_prefix is not defined it should be set to empty string. --- app/app.coffee | 1 - app/routes/main.coffee | 4 ++-- app/utils/pusher.coffee | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/app.coffee b/app/app.coffee index c29fcc07..2bdbda52 100644 --- a/app/app.coffee +++ b/app/app.coffee @@ -51,7 +51,6 @@ App = Ember.Application.extend(Ember.Evented, store.pushPayload(commits: [commit]) if event == 'job:log' - console.log 'store: received job:log event', data if Log.DEBUG data = data.job job = store.recordForId('job', data.id) job.appendLog(number: parseInt(data.number), content: data._log, final: data.final) diff --git a/app/routes/main.coffee b/app/routes/main.coffee index 0a884618..3b9c8e60 100644 --- a/app/routes/main.coffee +++ b/app/routes/main.coffee @@ -19,7 +19,7 @@ Route = TravisRoute.extend activate: -> # subscribe to pusher only if we're at a main route - if config.pusher.channels - @get('pusher').subscribeAll(config.pusher.channels) + unless config.pro + @get('pusher').subscribeAll(['common']) `export default Route` diff --git a/app/utils/pusher.coffee b/app/utils/pusher.coffee index 84aaef3c..7663cc0e 100644 --- a/app/utils/pusher.coffee +++ b/app/utils/pusher.coffee @@ -38,8 +38,9 @@ TravisPusher.prototype.unsubscribe = (channel) -> @pusher.unsubscribe(channel) if @pusher?.channel(channel) TravisPusher.prototype.prefix = (channel) -> - if channel.indexOf(config.pusher.channel_prefix) != 0 - "#{config.pusher.channel_prefix}#{channel}" + prefix = config.pusher.channel_prefix || '' + if channel.indexOf(prefix) != 0 + "#{prefix}#{channel}" else channel