Allow key conflict resolution for group updates

Creating a group with a member who's identity key has changed would
previously fail silently. Now, we catch and save the error, allowing the
same conflict resolution process as with regular messages.

Fixes #205
This commit is contained in:
lilia 2015-03-24 10:09:50 -07:00
parent 4bd46f80e7
commit e8cb4efaa4

View file

@ -128,8 +128,8 @@
this.trigger('open', {modelId: groupId});
}.bind(this));
var now = Date.now();
group.messageCollection.add({
conversationId : this.id,
var message = group.messageCollection.add({
conversationId : group.id,
type : 'outgoing',
sent_at : now,
received_at : now,
@ -138,13 +138,16 @@
avatar: group.get('avatar'),
joined: group.get('members')
}
}).save();
});
message.save();
textsecure.messaging.updateGroup(
group.id,
group.get('name'),
group.get('avatar'),
group.get('members')
);
).catch(function(errors) {
message.save({errors: errors.map(function(e){return e.error;})});
});
}.bind(this));
},