summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-01-27 12:47:08 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-01-27 12:47:08 -0500
commite50e26a2db6d7a4f42478b60f533a57dd33cc686 (patch)
treef831edf4dd14a3d162300f12c482d667d3cbbe1c
parent8b71d1700a85949d2a17f6bd4d058bd1c1e34f7b (diff)
parente20f78ad0d20ca7de6acc1150a0d544aebebe9d0 (diff)
downloadchat-e50e26a2db6d7a4f42478b60f533a57dd33cc686.tar.gz
chat-e50e26a2db6d7a4f42478b60f533a57dd33cc686.tar.bz2
chat-e50e26a2db6d7a4f42478b60f533a57dd33cc686.zip
Merge pull request #1998 from mattermost/plt-1139
PLT-1139 Clear user typing text on channel switch
-rw-r--r--web/react/components/msg_typing.jsx14
1 files changed, 11 insertions, 3 deletions
diff --git a/web/react/components/msg_typing.jsx b/web/react/components/msg_typing.jsx
index 78b67a216..35a832875 100644
--- a/web/react/components/msg_typing.jsx
+++ b/web/react/components/msg_typing.jsx
@@ -25,9 +25,17 @@ export default class MsgTyping extends React.Component {
SocketStore.addChangeListener(this.onChange);
}
- componentWillReceiveProps(newProps) {
- if (this.props.channelId !== newProps.channelId) {
- this.updateTypingText();
+ componentWillReceiveProps(nextProps) {
+ if (this.props.channelId !== nextProps.channelId) {
+ for (const u in this.typingUsers) {
+ if (!this.typingUsers.hasOwnProperty(u)) {
+ continue;
+ }
+
+ clearTimeout(this.typingUsers[u]);
+ }
+ this.typingUsers = {};
+ this.setState({text: ''});
}
}