Fix sync'd disappearing messages; prevent double-save

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-08-04 18:19:26 -07:00
parent 7e8f3ab5e7
commit 559619eb49
No known key found for this signature in database
GPG key ID: A4931C09644C654B

View file

@ -569,7 +569,15 @@
var start = this.get('expirationStartTimestamp');
var delta = this.get('expireTimer') * 1000;
var expires_at = start + delta;
this.save('expires_at', expires_at);
// This method can be called due to the expiration-related .set() calls in
// handleDataMessage(), but the .save() here would conflict with the
// same call at the end of handleDataMessage(). So we only call .save()
// here if we've previously saved this model.
if (!this.isNew()) {
this.save('expires_at', expires_at);
}
Whisper.ExpiringMessagesListener.update();
console.log('message', this.get('sent_at'), 'expires at', expires_at);
}