From 7649c180dd450e4cd30330652c36480bf05a1972 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Jan 2016 10:18:18 +0100 Subject: [PATCH] Fix cancel and restart buttons Callback functions for restart and cancel where improperly updated while switching from coffeescript to javascript. --- .../repo-actions-item-component-mixin.js | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/app/utils/repo-actions-item-component-mixin.js b/app/utils/repo-actions-item-component-mixin.js index f345121f..e5539b67 100644 --- a/app/utils/repo-actions-item-component-mixin.js +++ b/app/utils/repo-actions-item-component-mixin.js @@ -29,9 +29,7 @@ export default Ember.Mixin.create({ } this.set('restarting', true); onFinished = () => { - return function() { - return this.set('restarting', false); - }; + this.set('restarting', false); }; return this.get('item').restart().then(onFinished, onFinished); }, @@ -41,31 +39,28 @@ export default Ember.Mixin.create({ return; } this.set('cancelling', true); + type = this.get('type'); return this.get('item').cancel().then(() => { - return function() { - this.set('cancelling', false); + this.set('cancelling', false); + return Travis.flash({ + success: (type.capitalize()) + " has been successfully canceled." + }); + }, (xhr) => { + this.set('cancelling', false); + if (xhr.status === 422) { return Travis.flash({ - success: (type.capitalize()) + " has been successfully canceled." + error: "This " + type + " can't be canceled" }); - }; - }, () => { - return function(xhr) { - this.set('cancelling', false); - if (xhr.status === 422) { - return Travis.flash({ - error: "This " + type + " can't be canceled" - }); - } else if (xhr.status === 403) { - return Travis.flash({ - error: "You don't have sufficient access to cancel this " + type - }); - } else { - return Travis.flash({ - error: "An error occured when canceling the " + type - }); - } - }; + } else if (xhr.status === 403) { + return Travis.flash({ + error: "You don't have sufficient access to cancel this " + type + }); + } else { + return Travis.flash({ + error: "An error occured when canceling the " + type + }); + } }); } }