Properly updated pinned/flagged posts on deletion (#6920)

This commit is contained in:
Joram Wilander
2017-07-12 12:38:07 -04:00
committed by Saturnino Abril
parent d3506c9d69
commit 8395981d2b
3 changed files with 14 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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