Store attachments as binary blobs

Move base64 encoding of attachments to an AttachmentView. This makes
image rendering an asynchronous task so we fire an update event to
indicate to the parent MessageListView that its content has changed
height and it is time to scroll down.
This commit is contained in:
lilia 2014-11-20 15:43:51 -08:00
parent bf22da209f
commit 99a2685f93
7 changed files with 70 additions and 46 deletions

View file

@ -21,7 +21,12 @@
var Message = Backbone.Model.extend({
database: Whisper.Database,
storeName: 'messages',
defaults: function() { return { timestamp: new Date().getTime() }; },
defaults: function() {
return {
timestamp: new Date().getTime(),
attachments: []
};
},
validate: function(attributes, options) {
var required = ['timestamp', 'conversationId'];
var missing = _.filter(required, function(attr) { return !attributes[attr]; });