Don't load group contacts unnecessarily
There are some cases when we want to initialize a group object without loading its contacts, such as while processing delivery receipts. We really only need to load the contacts for a group/convo when we are rendering it, so let the front end handle those cases (which most of them do already).
This commit is contained in:
parent
ae6174c511
commit
6699571910
2 changed files with 13 additions and 12 deletions
|
@ -41,13 +41,12 @@
|
||||||
this.on('change:avatar', this.updateAvatarUrl);
|
this.on('change:avatar', this.updateAvatarUrl);
|
||||||
this.on('destroy', this.revokeAvatarUrl);
|
this.on('destroy', this.revokeAvatarUrl);
|
||||||
this.on('read', this.onReadMessage);
|
this.on('read', this.onReadMessage);
|
||||||
this.fetchContacts().then(function() {
|
var members = this.get('members') || [];
|
||||||
this.contactCollection.each(function(contact) {
|
members.map(function(number) {
|
||||||
textsecure.storage.protocol.on('keychange:' + contact.id, function() {
|
textsecure.storage.protocol.on('keychange:' + m.id, function() {
|
||||||
this.addKeyChange(contact.id);
|
this.conversation.addKeyChange(m.id);
|
||||||
}.bind(this));
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addKeyChange: function(id) {
|
addKeyChange: function(id) {
|
||||||
|
@ -324,7 +323,7 @@
|
||||||
} else {
|
} else {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
var members = this.get('members') || [];
|
var members = this.get('members') || [];
|
||||||
this.contactCollection.reset(
|
this.contactCollection.add(
|
||||||
members.map(function(number) {
|
members.map(function(number) {
|
||||||
var c = ConversationController.create({
|
var c = ConversationController.create({
|
||||||
id : number,
|
id : number,
|
||||||
|
|
|
@ -269,12 +269,14 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
messageDetail: function(e, data) {
|
messageDetail: function(e, data) {
|
||||||
var view = new Whisper.MessageDetailView({
|
return this.model.fetchContacts().then(function() {
|
||||||
model: data.message,
|
var view = new Whisper.MessageDetailView({
|
||||||
conversation: this.model
|
model: data.message,
|
||||||
|
conversation: this.model
|
||||||
|
});
|
||||||
|
this.listenBack(view);
|
||||||
|
view.render();
|
||||||
});
|
});
|
||||||
this.listenBack(view);
|
|
||||||
view.render();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
listenBack: function(view) {
|
listenBack: function(view) {
|
||||||
|
|
Loading…
Reference in a new issue