Dismiss typing indicator when ConversationView is not loaded

This commit is contained in:
Scott Nonnenberg 2018-11-26 17:09:50 -08:00
parent 70eed938d9
commit a291834301
1 changed files with 6 additions and 2 deletions

View File

@ -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;