From e8cb4efaa4a45c8fed5704de4fcfd06723910e29 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 24 Mar 2015 10:09:50 -0700 Subject: [PATCH] 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 --- js/views/new_conversation_view.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/views/new_conversation_view.js b/js/views/new_conversation_view.js index be788d0c1869..fafd79d7334a 100644 --- a/js/views/new_conversation_view.js +++ b/js/views/new_conversation_view.js @@ -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)); },