diff --git a/js/models/conversations.js b/js/models/conversations.js index aa7c5472..beef40de 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -41,13 +41,12 @@ this.on('change:avatar', this.updateAvatarUrl); this.on('destroy', this.revokeAvatarUrl); this.on('read', this.onReadMessage); - this.fetchContacts().then(function() { - this.contactCollection.each(function(contact) { - textsecure.storage.protocol.on('keychange:' + contact.id, function() { - this.addKeyChange(contact.id); - }.bind(this)); + var members = this.get('members') || []; + members.map(function(number) { + textsecure.storage.protocol.on('keychange:' + m.id, function() { + this.conversation.addKeyChange(m.id); }.bind(this)); - }.bind(this)); + }); }, addKeyChange: function(id) { @@ -324,7 +323,7 @@ } else { var promises = []; var members = this.get('members') || []; - this.contactCollection.reset( + this.contactCollection.add( members.map(function(number) { var c = ConversationController.create({ id : number, diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 65825b0e..d29349f2 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -269,12 +269,14 @@ }, messageDetail: function(e, data) { - var view = new Whisper.MessageDetailView({ - model: data.message, - conversation: this.model + return this.model.fetchContacts().then(function() { + var view = new Whisper.MessageDetailView({ + model: data.message, + conversation: this.model + }); + this.listenBack(view); + view.render(); }); - this.listenBack(view); - view.render(); }, listenBack: function(view) {