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:
parent
4bd46f80e7
commit
e8cb4efaa4
1 changed files with 7 additions and 4 deletions
|
@ -128,8 +128,8 @@
|
||||||
this.trigger('open', {modelId: groupId});
|
this.trigger('open', {modelId: groupId});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
group.messageCollection.add({
|
var message = group.messageCollection.add({
|
||||||
conversationId : this.id,
|
conversationId : group.id,
|
||||||
type : 'outgoing',
|
type : 'outgoing',
|
||||||
sent_at : now,
|
sent_at : now,
|
||||||
received_at : now,
|
received_at : now,
|
||||||
|
@ -138,13 +138,16 @@
|
||||||
avatar: group.get('avatar'),
|
avatar: group.get('avatar'),
|
||||||
joined: group.get('members')
|
joined: group.get('members')
|
||||||
}
|
}
|
||||||
}).save();
|
});
|
||||||
|
message.save();
|
||||||
textsecure.messaging.updateGroup(
|
textsecure.messaging.updateGroup(
|
||||||
group.id,
|
group.id,
|
||||||
group.get('name'),
|
group.get('name'),
|
||||||
group.get('avatar'),
|
group.get('avatar'),
|
||||||
group.get('members')
|
group.get('members')
|
||||||
);
|
).catch(function(errors) {
|
||||||
|
message.save({errors: errors.map(function(e){return e.error;})});
|
||||||
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue