Fix: Conversation.updateVerified fails when convo not yet in db
FREEBIE
This commit is contained in:
parent
9f4fcc5afa
commit
22208ec3f8
1 changed files with 5 additions and 2 deletions
|
@ -59,10 +59,12 @@
|
||||||
if (this.isPrivate()) {
|
if (this.isPrivate()) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
textsecure.storage.protocol.getVerified(this.id),
|
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) {
|
]).then(function(results) {
|
||||||
var trust = results[0];
|
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));
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
return this.fetchContacts().then(function() {
|
return this.fetchContacts().then(function() {
|
||||||
|
@ -597,6 +599,7 @@
|
||||||
type : 'private'
|
type : 'private'
|
||||||
});
|
});
|
||||||
this.listenTo(c, 'change:verified', this.onMemberVerifiedChange);
|
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) {
|
promises.push(new Promise(function(resolve) {
|
||||||
c.fetch().always(resolve);
|
c.fetch().always(resolve);
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue