From 21225b2074eedf7817643e39fff2a37b0fb81ca2 Mon Sep 17 00:00:00 2001 From: lilia Date: Sun, 26 Oct 2014 00:29:01 -0700 Subject: [PATCH] Save outgoing attachments --- js/models/threads.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/models/threads.js b/js/models/threads.js index ac40d307..92d5f18b 100644 --- a/js/models/threads.js +++ b/js/models/threads.js @@ -23,12 +23,17 @@ var Whisper = Whisper || {}; sendMessage: function(message, attachments) { var timestamp = Date.now(); + var base64_attachments = _.map(attachments, function(a) { + return ['data:', a.contentType, ';base64,', btoa(getString(a.data))].join(''); + }); this.messages().add({ type: 'outgoing', body: message, threadId: this.id, + attachments: base64_attachments, timestamp: timestamp }).save(); + this.save({ timestamp: timestamp, unreadCount: 0, active: true});