Skip to content

Commit

Permalink
Merge pull request #617 from travis-ci/ps-simplify-manual-repo-subscr…
Browse files Browse the repository at this point in the history
…iption

Don't add `private-` suffix manually to pusher channels
  • Loading branch information
drogus authored Jul 19, 2016
2 parents f500c1e + f5f29a1 commit dc8cc32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
6 changes: 1 addition & 5 deletions app/components/hook-switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ export default Ember.Component.extend({
repoId = hook.get('id');

return hook.toggle().then(() => {
let channel = 'repo-' + repoId;
if (hook.get('private') || this.get('config').enterprise) {
channel = 'private-' + channel;
}
pusher.subscribe(channel);
pusher.subscribe(`repo-${repoId}`);
}, () => {
this.toggleProperty('hook.active');
return this.sendAction('onToggleError', hook);
Expand Down
11 changes: 1 addition & 10 deletions app/components/not-active.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default Ember.Component.extend({

activate: task(function * () {
const apiEndpoint = config.apiEndpoint;
const repo = this.get('repo');
const repoId = this.get('repo.id');

try {
Expand All @@ -38,15 +37,7 @@ export default Ember.Component.extend({
});

if (response.active) {
const pusher = this.get('pusher');

let channel = `repo-${repoId}`;

if (repo.get('private') || this.get('config').enterprise) {
channel = `private-${channel}`;
}

pusher.subscribe(`repo-${repoId}`);
this.get('pusher').subscribe(`repo-${repoId}`);

this.get('repo').set('active', true);
this.get('flashes').success('Repository has been successfully activated.');
Expand Down

0 comments on commit dc8cc32

Please sign in to comment.