diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-19 09:56:34 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-19 09:56:34 -0700 |
commit | ea1b3129688dd76c80c7d41eec4f2eb60f9f0639 (patch) | |
tree | dadeed708df722d68d0344051fbdb9900a646c81 /web/react/components/msg_typing.jsx | |
parent | d776d1aa0c7416a2c96da17e9cc2b7ad7f6a7fca (diff) | |
parent | 93eaa80a3bfacbb0c4a350474ca3d81b28b5d7ab (diff) | |
download | chat-ea1b3129688dd76c80c7d41eec4f2eb60f9f0639.tar.gz chat-ea1b3129688dd76c80c7d41eec4f2eb60f9f0639.tar.bz2 chat-ea1b3129688dd76c80c7d41eec4f2eb60f9f0639.zip |
Merge pull request #1072 from mattermost/plt-554
PLT-554 Small refactor of websocket code on client and server
Diffstat (limited to 'web/react/components/msg_typing.jsx')
-rw-r--r-- | web/react/components/msg_typing.jsx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/web/react/components/msg_typing.jsx b/web/react/components/msg_typing.jsx index 569942390..1bd23c55c 100644 --- a/web/react/components/msg_typing.jsx +++ b/web/react/components/msg_typing.jsx @@ -1,8 +1,11 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -var SocketStore = require('../stores/socket_store.jsx'); -var UserStore = require('../stores/user_store.jsx'); +const SocketStore = require('../stores/socket_store.jsx'); +const UserStore = require('../stores/user_store.jsx'); + +const Constants = require('../utils/constants.jsx'); +const SocketEvents = Constants.SocketEvents; export default class MsgTyping extends React.Component { constructor(props) { @@ -33,9 +36,9 @@ export default class MsgTyping extends React.Component { } onChange(msg) { - if (msg.action === 'typing' && - this.props.channelId === msg.channel_id && - this.props.parentId === msg.props.parent_id) { + if (msg.action === SocketEvents.TYPING && + this.props.channelId === msg.channel_id && + this.props.parentId === msg.props.parent_id) { this.lastTime = new Date().getTime(); var username = 'Someone'; @@ -52,7 +55,7 @@ export default class MsgTyping extends React.Component { } }.bind(this), 3000); } - } else if (msg.action === 'posted' && msg.channel_id === this.props.channelId) { + } else if (msg.action === SocketEvents.POSTED && msg.channel_id === this.props.channelId) { this.setState({text: ''}); } } |