diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-07-12 12:38:07 -0400 |
---|---|---|
committer | Saturnino Abril <saturnino.abril@gmail.com> | 2017-07-13 01:38:07 +0900 |
commit | 8395981d2b3a02e2b61458cd19872632a45c2849 (patch) | |
tree | 38d5f84561976d5bba1645311f1bbaad35ec7ef5 | |
parent | d3506c9d69e25f67109ffaae4ebc32e79a61244d (diff) | |
download | chat-8395981d2b3a02e2b61458cd19872632a45c2849.tar.gz chat-8395981d2b3a02e2b61458cd19872632a45c2849.tar.bz2 chat-8395981d2b3a02e2b61458cd19872632a45c2849.zip |
Properly updated pinned/flagged posts on deletion (#6920)
-rw-r--r-- | webapp/actions/post_actions.jsx | 6 | ||||
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 7 | ||||
-rw-r--r-- | webapp/components/search_results_item.jsx | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index f319d59e3..836d3e380 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -216,6 +216,12 @@ export function deletePost(channelId, post, success) { data: post }); + // Needed for search store + AppDispatcher.handleViewAction({ + type: Constants.ActionTypes.REMOVE_POST, + post + }); + const {focusedPostId} = getState().views.channel; const channel = getState().entities.channels.channels[post.channel_id]; if (post.id === focusedPostId && channel) { diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 82c9df617..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'; @@ -265,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) { diff --git a/webapp/components/search_results_item.jsx b/webapp/components/search_results_item.jsx index c0f405eb4..3b632ee5e 100644 --- a/webapp/components/search_results_item.jsx +++ b/webapp/components/search_results_item.jsx @@ -21,7 +21,6 @@ import * as PostUtils from 'utils/post_utils.jsx'; import Constants from 'utils/constants.jsx'; const ActionTypes = Constants.ActionTypes; -import {Posts} from 'mattermost-redux/constants'; import React from 'react'; import PropTypes from 'prop-types'; @@ -187,7 +186,7 @@ export default class SearchResultsItem extends React.Component { let message; let flagContent; let rhsControls; - if (post.state === Posts.POST_DELETED) { + if (post.state === Constants.POST_DELETED) { message = ( <p> <FormattedMessage |