Merge branch 'sharing_no_groups' of github.com:nextcloud/passman into sharing_no_groups

This commit is contained in:
brantje 2016-10-06 20:40:27 +02:00
commit a8e54c810f
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
2 changed files with 19 additions and 4 deletions

View file

@ -333,7 +333,7 @@ angular.module('passmanApp')
console.log(data); console.log(data);
}).then(function(data){ }).then(function(data){
console.log(data); console.log(data);
console.error("FINAL CALLBACK");
}); });
//@TODO Update revisions with new key (async) //@TODO Update revisions with new key (async)

View file

@ -212,6 +212,10 @@ angular.module('passmanApp')
}).bind(this)); }).bind(this));
}).bind(this)); }).bind(this));
} }
if (this.parent.plain_credential.files.length == 0){
this.call_progress(new progress_datatype(0,0));
this.call_then("No files to update");
}
}; };
var promise_revisions_update = function(){ var promise_revisions_update = function(){
@ -223,16 +227,21 @@ angular.module('passmanApp')
this.revisions = revisions; this.revisions = revisions;
var revision_workload = function(){ var revision_workload = function(){
if (this.revisions.length == 0){
this.call_progress(new progress_datatype(0,0));
this.call_then("No history to update");
return;
}
var _revision = revisions[this.current]; var _revision = revisions[this.current];
//Decrypt! //Decrypt!
_revision.credential_data = service.decryptCredential(_revision.credential_data, this.parent.old_password); _revision.credential_data = service.decryptCredential(_revision.credential_data, this.parent.old_password);
_revision.credential_data = ShareService.encryptSharedCredential(_revision.credential_data, this.parent.new_password); _revision.credential_data = service.encryptCredential(_revision.credential_data, this.parent.new_password);
console.log('Used key for encrypting history ', this.new_password); console.log('Used key for encrypting history ', this.new_password);
this.current ++; this.current ++;
this.call_progress(new progress_datatype(this.current + this.upload, this.total)); this.call_progress(new progress_datatype(this.current + this.upload, this.total));
this.updateRevision(_revision).then((function(data){ service.updateRevision(_revision).then((function(data){
this.upload ++; this.upload ++;
this.call_progress(new progress_datatype(this.upload + this.current, this.total)); this.call_progress(new progress_datatype(this.upload + this.current, this.total));
if (this.current + this.upload == this.total){ if (this.current + this.upload == this.total){
@ -240,8 +249,11 @@ angular.module('passmanApp')
} }
}).bind(this)); }).bind(this));
setTimeout(revision_workload.bind(this), 1); if (!this.current + this.upload == this.total) {
setTimeout(revision_workload.bind(this), 1);
}
}; };
setTimeout(revision_workload.bind(this), 1);
}).bind(this)); }).bind(this));
}; };
@ -261,12 +273,14 @@ angular.module('passmanApp')
(new C_Promise(promise_credential_update, new password_data())).progress(function(data){ (new C_Promise(promise_credential_update, new password_data())).progress(function(data){
master_promise.call_progress(data); master_promise.call_progress(data);
}).then(function(data){ }).then(function(data){
console.warn("End credential update");
master_promise.plain_credential = data; master_promise.plain_credential = data;
master_promise.promises ++; master_promise.promises ++;
(new C_Promise(promise_files_update, new password_data())).progress(function(data){ (new C_Promise(promise_files_update, new password_data())).progress(function(data){
master_promise.call_progress(data); master_promise.call_progress(data);
}).then(function(data){ }).then(function(data){
console.warn("End files update");
master_promise.promises --; master_promise.promises --;
if (master_promise.promises == 0){ if (master_promise.promises == 0){
master_promise.call_then("All done"); master_promise.call_then("All done");
@ -277,6 +291,7 @@ angular.module('passmanApp')
(new C_Promise(promise_revisions_update, new password_data())).progress(function(data){ (new C_Promise(promise_revisions_update, new password_data())).progress(function(data){
master_promise.call_progress(data); master_promise.call_progress(data);
}).then(function(data){ }).then(function(data){
console.warn("End revisions update");
master_promise.promises --; master_promise.promises --;
if (master_promise.promises == 0){ if (master_promise.promises == 0){
master_promise.call_then("All done"); master_promise.call_then("All done");