Skip to content

Commit

Permalink
Dismiss typing indicator when ConversationView is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Nov 27, 2018
1 parent 70eed93 commit a291834
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/models/conversations.js
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a291834

Please sign in to comment.