From fdce4cfc7c747c6f8ffff2177019b719ad325f21 Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 23 Jun 2017 12:24:07 -0700 Subject: [PATCH] Fix failed identity key sync from contact sync These were failing because ByteBuffers from the protobufs need to be converted to ArrayBuffers. Fixed by useing the existing handler in MessageReceiver to process verified messages from contact sync messages and dispatch them as their own events, reducing some complexity on the application side. // FREEBIE --- js/background.js | 4 ---- js/libtextsecure.js | 7 ++++++- libtextsecure/message_receiver.js | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/js/background.js b/js/background.js index f1e6340578e7..3373862b3f9b 100644 --- a/js/background.js +++ b/js/background.js @@ -163,10 +163,6 @@ } ConversationController.create(c).save(); - - if (contactDetails.verified) { - onVerified(contactDetails); - } } function onGroupReceived(ev) { diff --git a/js/libtextsecure.js b/js/libtextsecure.js index f0a32f6ddf8e..53f2ef44f740 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38526,10 +38526,15 @@ MessageReceiver.prototype.extend({ var ev = new Event('contact'); ev.contactDetails = contactDetails; eventTarget.dispatchEvent(ev); + + if (contactDetails.verified) { + this.handleVerified([contactDetails.verified]); + } + contactDetails = contactBuffer.next(); } eventTarget.dispatchEvent(new Event('contactsync')); - }); + }.bind(this)); }, handleGroups: function(groups) { console.log('group sync'); diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index a6e64258e6d7..dc5ef5a05feb 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -317,10 +317,15 @@ MessageReceiver.prototype.extend({ var ev = new Event('contact'); ev.contactDetails = contactDetails; eventTarget.dispatchEvent(ev); + + if (contactDetails.verified) { + this.handleVerified([contactDetails.verified]); + } + contactDetails = contactBuffer.next(); } eventTarget.dispatchEvent(new Event('contactsync')); - }); + }.bind(this)); }, handleGroups: function(groups) { console.log('group sync');