diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-18 14:42:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-18 14:42:32 -0400 |
commit | ab67f6e257f6e8f08145a02a7b93550f99641be4 (patch) | |
tree | d33d1c58a3d229f7e37db58bc2c397ac3806c503 /webapp/actions/websocket_actions.jsx | |
parent | 0231e95f1c5a8c42ba97875f0d2301815f552974 (diff) | |
download | chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.tar.gz chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.tar.bz2 chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.zip |
PLT-6215 Major post list refactor (#6501)
* Major post list refactor
* Fix post and thread deletion
* Fix preferences not selecting correctly
* Fix military time displaying
* Fix UP key for editing posts
* Fix ESLint error
* Various fixes and updates per feedback
* Fix for permalink view
* Revert to old scrolling method and various fixes
* Add floating timestamp, new message indicator, scroll arrows
* Update post loading for focus mode and add visibility limit
* Fix pinning posts and a react warning
* Add loading UI updates from Asaad
* Fix refreshing loop
* Temporarily bump post visibility limit
* Update infinite scrolling
* Remove infinite scrolling
Diffstat (limited to 'webapp/actions/websocket_actions.jsx')
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index b7a0b12a8..1aaecfb71 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -5,7 +5,6 @@ import $ from 'jquery'; import UserStore from 'stores/user_store.jsx'; import TeamStore from 'stores/team_store.jsx'; -import PostStore from 'stores/post_store.jsx'; import PreferenceStore from 'stores/preference_store.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import BrowserStore from 'stores/browser_store.jsx'; @@ -21,7 +20,7 @@ import * as AsyncClient from 'utils/async_client.jsx'; import {getSiteURL} from 'utils/url.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; -import {handleNewPost, loadPosts, loadProfilesForPosts} from 'actions/post_actions.jsx'; +import {handleNewPost, loadProfilesForPosts} from 'actions/post_actions.jsx'; import {loadProfilesForSidebar} from 'actions/user_actions.jsx'; import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx'; import * as StatusActions from 'actions/status_actions.jsx'; @@ -36,8 +35,9 @@ const dispatch = store.dispatch; const getState = store.getState; import {batchActions} from 'redux-batched-actions'; import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels'; +import {getPosts} from 'mattermost-redux/actions/posts'; import {setServerVersion} from 'mattermost-redux/actions/general'; -import {ChannelTypes, TeamTypes, UserTypes} from 'mattermost-redux/action_types'; +import {ChannelTypes, TeamTypes, UserTypes, PostTypes} from 'mattermost-redux/action_types'; const MAX_WEBSOCKET_FAILS = 7; @@ -97,7 +97,7 @@ export function reconnect(includeWebSocket = true) { if (Client.teamId) { loadChannelsForCurrentUser(); - loadPosts(ChannelStore.getCurrentId()); + getPosts(ChannelStore.getCurrentId())(dispatch, getState); StatusActions.loadStatusesForChannelAndSidebar(); } @@ -246,8 +246,7 @@ function handleNewPostEvent(msg) { function handlePostEditEvent(msg) { // Store post const post = JSON.parse(msg.data.post); - PostStore.storePost(post, false); - PostStore.emitChange(); + dispatch({type: PostTypes.RECEIVED_POST, data: post}); // Update channel state if (ChannelStore.getCurrentId() === msg.broadcast.channel_id) { @@ -259,7 +258,7 @@ function handlePostEditEvent(msg) { function handlePostDeleteEvent(msg) { const post = JSON.parse(msg.data.post); - GlobalActions.emitPostDeletedEvent(post); + dispatch({type: PostTypes.POST_DELETED, data: post}); } function handleTeamAddedEvent(msg) { @@ -424,19 +423,17 @@ function handleWebrtc(msg) { function handleReactionAddedEvent(msg) { const reaction = JSON.parse(msg.data.reaction); - AppDispatcher.handleServerAction({ - type: ActionTypes.ADDED_REACTION, - postId: reaction.post_id, - reaction + dispatch({ + type: PostTypes.RECEIVED_REACTION, + data: reaction }); } function handleReactionRemovedEvent(msg) { const reaction = JSON.parse(msg.data.reaction); - AppDispatcher.handleServerAction({ - type: ActionTypes.REMOVED_REACTION, - postId: reaction.post_id, - reaction + dispatch({ + type: PostTypes.REACTION_DELETED, + data: reaction }); } |