diff --git a/assets/scripts/app/models/job.coffee b/assets/scripts/app/models/job.coffee index 23649a37..61da5527 100644 --- a/assets/scripts/app/models/job.coffee +++ b/assets/scripts/app/models/job.coffee @@ -93,17 +93,18 @@ require 'travis/model' return if @get('subscribed') @set('subscribed', true) if Travis.pusher - Travis.pusher.subscribe "job-#{@get('id')}" + prefix = if @get('repo.private') then 'private-' else '' + Travis.pusher.subscribe "#{prefix}job-#{@get('id')}", unsubscribe: -> return unless @get('subscribed') @set('subscribed', false) if Travis.pusher + prefix = if @get('repo.private') then 'private-' else '' Travis.pusher.unsubscribe "job-#{@get('id')}" onStateChange: (-> - if @get('state') == 'finished' && Travis.pusher - Travis.pusher.unsubscribe "job-#{@get('id')}" + @unsubscribe() if @get('state') == 'finished' && Travis.pusher ).observes('state') isPropertyLoaded: (key) -> diff --git a/assets/scripts/app/models/repo.coffee b/assets/scripts/app/models/repo.coffee index f3fb1ff5..a26d093c 100644 --- a/assets/scripts/app/models/repo.coffee +++ b/assets/scripts/app/models/repo.coffee @@ -5,6 +5,7 @@ require 'travis/model' id: Ember.attr('string') slug: Ember.attr('string') description: Ember.attr('string') + private: Ember.attr('boolean') lastBuildId: Ember.attr('string') lastBuildNumber: Ember.attr(Number) lastBuildState: Ember.attr('string') diff --git a/assets/scripts/app/pusher.coffee b/assets/scripts/app/pusher.coffee index 6c9927ec..17253183 100644 --- a/assets/scripts/app/pusher.coffee +++ b/assets/scripts/app/pusher.coffee @@ -4,7 +4,6 @@ Travis.Pusher = (key) -> $.extend Travis.Pusher, CHANNELS: ['common'] - CHANNEL_PREFIX: '' ENCRYPTED: false $.extend Travis.Pusher.prototype, @@ -27,19 +26,14 @@ $.extend Travis.Pusher.prototype, @subscribe(channel) for channel in channels subscribe: (channel) -> - channel = @prefix(channel) console.log("subscribing to #{channel}") unless @pusher?.channel(channel) @pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unsubscribe: (channel) -> - channel = @prefix(channel) console.log("unsubscribing from #{channel}") @pusher.unsubscribe(channel) if @pusher?.channel(channel) - prefix: (channel) -> - "#{Travis.Pusher.CHANNEL_PREFIX}#{channel}" - # process pusher messages in batches every 5 minutes when the page is hidden processingIntervalWhenHidden: 1000 * 60 * 5