From 17a3025af27c49dd35f66402024330aafa26a7c3 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 16 Jul 2015 11:05:47 -0700 Subject: [PATCH] Mark end session messages sent --- js/models/conversations.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index be01e51f..d0bd9588 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -127,14 +127,17 @@ endSession: function() { if (this.get('type') === 'private') { var now = Date.now(); - textsecure.messaging.closeSession(this.id); - this.messageCollection.add({ + var message = this.messageCollection.add({ conversationId : this.id, type : 'outgoing', sent_at : now, received_at : now, flags : textsecure.protobuf.DataMessage.Flags.END_SESSION - }).save(); + }); + message.save(); + textsecure.messaging.closeSession(this.id).then(function() { + message.save({sent: true}); + }); } },