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/channel_header.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/channel_header.jsx')
-rw-r--r-- | web/react/components/channel_header.jsx | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx index 7582de6c4..1b709336f 100644 --- a/web/react/components/channel_header.jsx +++ b/web/react/components/channel_header.jsx @@ -4,7 +4,6 @@ const ChannelStore = require('../stores/channel_store.jsx'); const UserStore = require('../stores/user_store.jsx'); const PostStore = require('../stores/post_store.jsx'); -const SocketStore = require('../stores/socket_store.jsx'); const NavbarSearchBox = require('./search_bar.jsx'); const AsyncClient = require('../utils/async_client.jsx'); const Client = require('../utils/client.jsx'); @@ -25,7 +24,6 @@ export default class ChannelHeader extends React.Component { super(props); this.onListenerChange = this.onListenerChange.bind(this); - this.onSocketChange = this.onSocketChange.bind(this); this.handleLeave = this.handleLeave.bind(this); this.searchMentions = this.searchMentions.bind(this); @@ -45,7 +43,6 @@ export default class ChannelHeader extends React.Component { ChannelStore.addExtraInfoChangeListener(this.onListenerChange); PostStore.addSearchChangeListener(this.onListenerChange); UserStore.addChangeListener(this.onListenerChange); - SocketStore.addChangeListener(this.onSocketChange); } componentWillUnmount() { ChannelStore.removeChangeListener(this.onListenerChange); @@ -60,16 +57,9 @@ export default class ChannelHeader extends React.Component { } $('.channel-header__info .description').popover({placement: 'bottom', trigger: 'hover', html: true, delay: {show: 500, hide: 500}}); } - onSocketChange(msg) { - if (msg.action === 'new_user' || - msg.action === 'user_added' || - (msg.action === 'user_removed' && msg.user_id !== UserStore.getCurrentId())) { - AsyncClient.getChannelExtraInfo(true); - } - } handleLeave() { Client.leaveChannel(this.state.channel.id, - function handleLeaveSuccess() { + () => { AppDispatcher.handleViewAction({ type: ActionTypes.LEAVE_CHANNEL, id: this.state.channel.id @@ -77,8 +67,8 @@ export default class ChannelHeader extends React.Component { const townsquare = ChannelStore.getByName('town-square'); Utils.switchChannel(townsquare); - }.bind(this), - function handleLeaveError(err) { + }, + (err) => { AsyncClient.dispatchError(err, 'handleLeave'); } ); |