Resolve multiple conflicts independently

When resolving multiple conflicts in a conversation, failure to resolve
one should not block any others.

// FREEBIE
This commit is contained in:
lilia 2015-09-15 11:02:17 -07:00
parent 299bd45cea
commit 4b0c70fb44
2 changed files with 6 additions and 8 deletions

View file

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

View file

@ -28,11 +28,9 @@
} }
}, },
resolve: function() { resolve: function() {
new Promise(function(resolve) {
this.conversation.resolveConflicts(this.model).then(resolve);
}.bind(this));
this.trigger('resolve'); this.trigger('resolve');
this.remove(); this.remove();
this.conversation.resolveConflicts(this.model);
}, },
render: function() { render: function() {
this.$el.html(Mustache.render(this.template, this.model)); this.$el.html(Mustache.render(this.template, this.model));