Resolve conflicts in series

Attempting to resolve outgoing conflicts in parallel triggers multiple
requests for new keys from the server and causes it to return a 500
error.
pull/749/head
lilia 10 years ago
parent f3f084398f
commit 3e73f8f0ba

@ -273,11 +273,15 @@
return textsecure.storage.axolotl.removeIdentityKey(number).then(function() {
return textsecure.storage.axolotl.putIdentityKey(number, identityKey).then(function() {
var promise = Promise.resolve();
this.messageCollection.each(function(message) {
if (message.hasKeyConflict(number)) {
message.resolveConflict(number);
promise = promise.then(function() {
return message.resolveConflict(number);
});
}
});
return promise;
}.bind(this));
}.bind(this));
},

@ -121,6 +121,7 @@
this.save({sent: true, errors: errors});
}.bind(this));
}
return promise;
}
},
handleDataMessage: function(dataMessage) {

Loading…
Cancel
Save