diff --git a/js/models/messages.js b/js/models/messages.js index 3e7ea0a70..e2c3d04dd 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -5,10 +5,16 @@ 'use strict'; window.Whisper = window.Whisper || {}; + const { Message: TypedMessage } = window.Signal.Types; + var Message = window.Whisper.Message = Backbone.Model.extend({ database : Whisper.Database, storeName : 'messages', - initialize: function() { + initialize: function(attributes) { + if (_.isObject(attributes)) { + this.set(TypedMessage.initializeSchemaVersion(attributes)); + } + this.on('change:attachments', this.updateImageUrl); this.on('destroy', this.revokeImageUrl); this.on('change:expirationStartTimestamp', this.setToExpire);