Use generic collection for conversation contacts
Let the conversation controller instatiate the models in order to avoid having duplicate models in memory. // FREEBIE
This commit is contained in:
		
					parent
					
						
							
								6d4bf4e5d1
							
						
					
				
			
			
				commit
				
					
						2ab7315c80
					
				
			
		
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue