Initialize schema version during Message construction
		
	This commit is contained in:
		
					parent
					
						
							
								9a540d6d18
							
						
					
				
			
			
				commit
				
					
						e3dbeba963
					
				
			
		
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -5,10 +5,16 @@
 | 
				
			||||||
    'use strict';
 | 
					    'use strict';
 | 
				
			||||||
    window.Whisper = window.Whisper || {};
 | 
					    window.Whisper = window.Whisper || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const { Message: TypedMessage } = window.Signal.Types;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var Message  = window.Whisper.Message = Backbone.Model.extend({
 | 
					    var Message  = window.Whisper.Message = Backbone.Model.extend({
 | 
				
			||||||
        database  : Whisper.Database,
 | 
					        database  : Whisper.Database,
 | 
				
			||||||
        storeName : 'messages',
 | 
					        storeName : 'messages',
 | 
				
			||||||
        initialize: function() {
 | 
					        initialize: function(attributes) {
 | 
				
			||||||
 | 
					            if (_.isObject(attributes)) {
 | 
				
			||||||
 | 
					                this.set(TypedMessage.initializeSchemaVersion(attributes));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.on('change:attachments', this.updateImageUrl);
 | 
					            this.on('change:attachments', this.updateImageUrl);
 | 
				
			||||||
            this.on('destroy', this.revokeImageUrl);
 | 
					            this.on('destroy', this.revokeImageUrl);
 | 
				
			||||||
            this.on('change:expirationStartTimestamp', this.setToExpire);
 | 
					            this.on('change:expirationStartTimestamp', this.setToExpire);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue