From 6509646bdb28af4963ce28e38b24760d663aa282 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 20 Feb 2017 19:12:53 -0800 Subject: [PATCH] Set expireTimer to null to unset // FREEBIE --- js/models/conversations.js | 1 + js/models/messages.js | 2 +- js/views/conversation_view.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 519dcbf7..422bcb12 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -199,6 +199,7 @@ }, updateExpirationTimer: function(expireTimer, source, received_at) { + if (!expireTimer) { expireTimer = null; } source = source || textsecure.storage.user.getNumber(); var timestamp = received_at || Date.now(); this.save({ expireTimer: expireTimer }); diff --git a/js/models/messages.js b/js/models/messages.js index eee399c0..184d3904 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -424,7 +424,7 @@ message.get('received_at')); } } else if (conversation.get('expireTimer')) { - conversation.updateExpirationTimer(0, source, + conversation.updateExpirationTimer(null, source, message.get('received_at')); } } diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 0f7be381..194feaa2 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -32,8 +32,10 @@ }, setTimer: function(e) { var seconds = this.$(e.target).data().seconds; - if (seconds >= 0) { + if (seconds > 0) { this.model.updateExpirationTimer(seconds); + } else { + this.model.updateExpirationTimer(null); } }, render: function() {