From a2918343014d9f27ca0f1d3a6798b2119248c097 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 26 Nov 2018 17:09:50 -0800 Subject: [PATCH] Dismiss typing indicator when ConversationView is not loaded --- js/models/conversations.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 1928bf5e9af9..ef5da5525149 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -112,7 +112,7 @@ this.updateLastMessage ); - this.on('newmessage', this.updateLastMessage); + this.on('newmessage', this.onNewMessage); this.on('change:profileKey', this.onChangeProfileKey); // Listening for out-of-band data updates @@ -269,13 +269,17 @@ removeMessage(); }, - addSingleMessage(message) { + async onNewMessage(message) { + await this.updateLastMessage(); + // Clear typing indicator for a given contact if we receive a message from them const identifier = message.get ? `${message.get('source')}.${message.get('sourceDevice')}` : `${message.source}.${message.sourceDevice}`; this.clearContactTypingTimer(identifier); + }, + addSingleMessage(message) { const model = this.messageCollection.add(message, { merge: true }); model.setToExpire(); return model;