The first message sent to a new contact was throwing 'Unknown Group'.
This was because we didn't wait for the initial save to sync the `type`
attribute to indexedDB. Instead, don't trigger the conversation to open
until it has finished saving.
This commit is contained in:
lilia 2015-02-13 12:55:13 -08:00
parent eddf4164fa
commit 85b4643e9b

View file

@ -189,8 +189,11 @@ var Whisper = Whisper || {};
conversation.fetch().then(function() {
this.$el.trigger('open', { modelId: conversation.id });
}.bind(this)).fail(function() {
if (conversation.save()) {
this.$el.trigger('open', { modelId: conversation.id });
var saved = conversation.save(); // false or indexedDBRequest
if (saved) {
saved.then(function() {
this.$el.trigger('open', { modelId: conversation.id });
}.bind(this));
}
}.bind(this));
},