Fetch conversation before saving in all sync handlers
FREEBIE
This commit is contained in:
parent
9db0a58260
commit
0adc398a6f
3 changed files with 98 additions and 67 deletions
|
@ -84,24 +84,26 @@
|
|||
},
|
||||
safeFetch: function() {
|
||||
// new Promise necessary because a fetch will fail if convo not in db yet
|
||||
return new Promise(function(resolve) { this.fetch().always(resolve); }.bind(this));
|
||||
return new Promise(function(resolve) {
|
||||
this.fetch().always(resolve);
|
||||
}.bind(this));
|
||||
},
|
||||
setVerifiedDefault: function(options) {
|
||||
var DEFAULT = this.verifiedEnum.DEFAULT;
|
||||
return this.queueJob(function() {
|
||||
return this.safeFetch().then(this._setVerified.bind(this, DEFAULT, options));
|
||||
return this._setVerified(DEFAULT, options);
|
||||
}.bind(this));
|
||||
},
|
||||
setVerified: function(options) {
|
||||
var VERIFIED = this.verifiedEnum.VERIFIED;
|
||||
return this.queueJob(function() {
|
||||
return this.safeFetch().then(this._setVerified.bind(this, VERIFIED, options));
|
||||
return this._setVerified(VERIFIED, options);
|
||||
}.bind(this));
|
||||
},
|
||||
setUnverified: function(options) {
|
||||
var UNVERIFIED = this.verifiedEnum.UNVERIFIED;
|
||||
return this.queueJob(function() {
|
||||
return this.safeFetch().then(this._setVerified.bind(this, UNVERIFIED, options));
|
||||
return this._setVerified(UNVERIFIED, options);
|
||||
}.bind(this));
|
||||
},
|
||||
_setVerified: function(verified, options) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue