From 2ab7315c8001dc59511fea2f30dba53ae7677d19 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 7 Sep 2015 17:22:59 -0700 Subject: [PATCH] Use generic collection for conversation contacts Let the conversation controller instatiate the models in order to avoid having duplicate models in memory. // FREEBIE --- js/models/conversations.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index ee235a6f..b32ff196 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -19,7 +19,7 @@ }, initialize: function() { - this.contactCollection = new Whisper.ConversationCollection(); + this.contactCollection = new Backbone.Collection(); this.messageCollection = new Whisper.MessageCollection([], { conversation: this }); @@ -162,7 +162,10 @@ var members = this.get('members') || []; this.contactCollection.reset( members.map(function(number) { - var c = this.collection.add({id: number, type: 'private'}); + var c = ConversationController.create({ + id : number, + type : 'private' + }); c.fetch(); return c; }.bind(this))