Fixes #161
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:
parent
eddf4164fa
commit
85b4643e9b
1 changed files with 5 additions and 2 deletions
|
@ -189,8 +189,11 @@ var Whisper = Whisper || {};
|
||||||
conversation.fetch().then(function() {
|
conversation.fetch().then(function() {
|
||||||
this.$el.trigger('open', { modelId: conversation.id });
|
this.$el.trigger('open', { modelId: conversation.id });
|
||||||
}.bind(this)).fail(function() {
|
}.bind(this)).fail(function() {
|
||||||
if (conversation.save()) {
|
var saved = conversation.save(); // false or indexedDBRequest
|
||||||
this.$el.trigger('open', { modelId: conversation.id });
|
if (saved) {
|
||||||
|
saved.then(function() {
|
||||||
|
this.$el.trigger('open', { modelId: conversation.id });
|
||||||
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue