Fetch group contacts before fetching new messages
Messages must wait for sender info to arrive before rendering. // FREEBIE
This commit is contained in:
parent
edbf2371bf
commit
1a30d003f5
2 changed files with 26 additions and 18 deletions
|
@ -174,21 +174,28 @@
|
|||
},
|
||||
|
||||
fetchContacts: function(options) {
|
||||
if (this.isPrivate()) {
|
||||
this.contactCollection.reset([this]);
|
||||
} else {
|
||||
var members = this.get('members') || [];
|
||||
this.contactCollection.reset(
|
||||
members.map(function(number) {
|
||||
var c = ConversationController.create({
|
||||
id : number,
|
||||
type : 'private'
|
||||
});
|
||||
c.fetch();
|
||||
return c;
|
||||
}.bind(this))
|
||||
);
|
||||
}
|
||||
return new Promise(function(resolve) {
|
||||
if (this.isPrivate()) {
|
||||
this.contactCollection.reset([this]);
|
||||
resolve();
|
||||
} else {
|
||||
var promises = [];
|
||||
var members = this.get('members') || [];
|
||||
this.contactCollection.reset(
|
||||
members.map(function(number) {
|
||||
var c = ConversationController.create({
|
||||
id : number,
|
||||
type : 'private'
|
||||
});
|
||||
promises.push(new Promise(function(resolve) {
|
||||
c.fetch().always(resolve);
|
||||
}));
|
||||
return c;
|
||||
}.bind(this))
|
||||
);
|
||||
resolve(Promise.all(promises));
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue