From 22208ec3f843e1a9f890f1bfaf5880239188c959 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 22 Jun 2017 14:01:58 -0700 Subject: [PATCH] Fix: Conversation.updateVerified fails when convo not yet in db FREEBIE --- js/models/conversations.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index c0e3aff9bdc7..25d05f2ebbda 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -59,10 +59,12 @@ if (this.isPrivate()) { return Promise.all([ textsecure.storage.protocol.getVerified(this.id), - this.fetch() + // new Promise necessary because a fetch will fail if convo not in db yet + new Promise(function(resolve) { this.fetch().always(resolve); }.bind(this)) ]).then(function(results) { var trust = results[0]; - return this.save({verified: trust}); + // we don't return here because we don't need to wait for this to finish + this.save({verified: trust}); }.bind(this)); } else { return this.fetchContacts().then(function() { @@ -597,6 +599,7 @@ type : 'private' }); this.listenTo(c, 'change:verified', this.onMemberVerifiedChange); + // new Promise necessary because a fetch will fail if convo not in db yet promises.push(new Promise(function(resolve) { c.fetch().always(resolve); }));