diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-04-28 13:16:03 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-04-28 13:16:03 -0400 |
commit | 96906482cecb0df21c8e1a40a2ba00c13c0182a7 (patch) | |
tree | 3bb35ca9fe2a3beb212b5350116f7bb488d7a119 /webapp/actions/global_actions.jsx | |
parent | 302ec17beed9128101ef61d69b45d3ee29e16f1e (diff) | |
download | chat-96906482cecb0df21c8e1a40a2ba00c13c0182a7.tar.gz chat-96906482cecb0df21c8e1a40a2ba00c13c0182a7.tar.bz2 chat-96906482cecb0df21c8e1a40a2ba00c13c0182a7.zip |
PLT-6214 Move channel store and actions over to redux (#6235)
* Move channel store and actions over to redux
* Fix style errors
* Fix unit test
* Various fixes
* More fixes
* Revert config changes
Diffstat (limited to 'webapp/actions/global_actions.jsx')
-rw-r--r-- | webapp/actions/global_actions.jsx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 9709f5f80..1dd5d6952 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -35,8 +35,8 @@ import {browserHistory} from 'react-router/es6'; import store from 'stores/redux_store.jsx'; const dispatch = store.dispatch; const getState = store.getState; -import {ChannelTypes} from 'mattermost-redux/action_types'; import {removeUserFromTeam} from 'mattermost-redux/actions/teams'; +import {viewChannel, getChannelStats, getChannelMember} from 'mattermost-redux/actions/channels'; export function emitChannelClickEvent(channel) { function userVisitedFakeChannel(chan, success, fail) { @@ -53,12 +53,12 @@ export function emitChannelClickEvent(channel) { } function switchToChannel(chan) { const channelMember = ChannelStore.getMyMember(chan.id); - const getMyChannelMemberPromise = AsyncClient.getChannelMember(chan.id, UserStore.getCurrentId()); + const getMyChannelMemberPromise = getChannelMember(chan.id, UserStore.getCurrentId())(dispatch, getState); const oldChannelId = ChannelStore.getCurrentId(); getMyChannelMemberPromise.then(() => { - AsyncClient.getChannelStats(chan.id, true); - AsyncClient.viewChannel(chan.id, oldChannelId); + getChannelStats(chan.id)(dispatch, getState); + viewChannel(chan.id)(dispatch, getState); loadPosts(chan.id); }); @@ -83,11 +83,6 @@ export function emitChannelClickEvent(channel) { channelMember, prev: oldChannelId }); - - dispatch({ - type: ChannelTypes.SELECT_CHANNEL, - data: chan.id - }, getState); } if (channel.fake) { @@ -113,7 +108,7 @@ export function doFocusPost(channelId, postId, data) { post_list: data }); loadChannelsForCurrentUser(); - AsyncClient.getChannelStats(channelId); + getChannelStats(channelId)(dispatch, getState); loadPostsBefore(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true); loadPostsAfter(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true); } |