Always do restart after update. fix #363

This commit is contained in:
Ruud committed 2012-05-28 20:50:21 +02:00
1 parent b2ccca9299
commit 523a1e7d63
4 files changed
+57 -24

No files matched your search

@@ -16,7 +16,15 @@ var UpdaterBase = new Class({
var self = this;
Api.request('updater.check', {
'onComplete': onComplete || Function.from()
'onComplete': function(json){
if(onComplete)
onComplete(json);
if(json.update_available)
self.doUpdate();
else
App.unBlockPage()
}
})
},
@@ -81,15 +89,19 @@ var UpdaterBase = new Class({
Api.request('updater.update', {
'onComplete': function(json){
if(json.success){
App.restart('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating');
App.checkAvailable.delay(500, App, [1000, function(){
window.location.reload();
}]);
if(self.message)
self.message.destroy();
self.updating();
}
}
});
},
updating: function(){
App.blockPage('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating');
App.checkAvailable.delay(500, App, [1000, function(){
window.location.reload();
}]);
if(self.message)
self.message.destroy();
}
});