diff options
Diffstat (limited to 'webapp/actions/websocket_actions.jsx')
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index dec3edd12..184013179 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. import $ from 'jquery'; +import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import UserStore from 'stores/user_store.jsx'; import TeamStore from 'stores/team_store.jsx'; @@ -15,7 +16,7 @@ import WebSocketClient from 'client/web_websocket_client.jsx'; import * as WebrtcActions from './webrtc_actions.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; -import {handleNewPost, loadProfilesForPosts} from 'actions/post_actions.jsx'; +import {handleNewPost} 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'; @@ -34,7 +35,7 @@ import {getSiteURL} from 'utils/url.jsx'; import * as TeamActions from 'mattermost-redux/actions/teams'; import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels'; -import {getPosts} from 'mattermost-redux/actions/posts'; +import {getPosts, getProfilesAndStatusesForPosts} from 'mattermost-redux/actions/posts'; import {setServerVersion} from 'mattermost-redux/actions/general'; import {ChannelTypes, TeamTypes, UserTypes, PostTypes, EmojiTypes} from 'mattermost-redux/action_types'; @@ -242,9 +243,7 @@ function handleNewPostEvent(msg) { const post = JSON.parse(msg.data.post); handleNewPost(post, msg); - const posts = {}; - posts[post.id] = post; - loadProfilesForPosts(posts); + getProfilesAndStatusesForPosts([post], dispatch, getState); if (post.user_id !== UserStore.getCurrentId()) { UserStore.setStatus(post.user_id, UserStatuses.ONLINE); @@ -267,6 +266,12 @@ function handlePostEditEvent(msg) { function handlePostDeleteEvent(msg) { const post = JSON.parse(msg.data.post); dispatch({type: PostTypes.POST_DELETED, data: post}); + + // Needed for search store + AppDispatcher.handleViewAction({ + type: Constants.ActionTypes.POST_DELETED, + post + }); } async function handleTeamAddedEvent(msg) { |