From 944e74feb87d9a0acbe66c0c08a74ad450ea79bd Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 6 Mar 2017 16:10:43 -0500 Subject: Prevented RHS from closing when you reply to a message that had been deleted. (#5651) --- webapp/actions/websocket_actions.jsx | 5 ----- webapp/components/create_comment.jsx | 2 ++ webapp/components/post_deleted_modal.jsx | 22 ---------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index b442b9083..913a89221 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -212,11 +212,6 @@ function handlePostEditEvent(msg) { function handlePostDeleteEvent(msg) { const post = JSON.parse(msg.data.post); GlobalActions.emitPostDeletedEvent(post); - - const selectedPostId = PostStore.getSelectedPostId(); - if (selectedPostId === post.id) { - GlobalActions.emitCloseRightHandSide(); - } } function handleLeaveTeamEvent(msg) { diff --git a/webapp/components/create_comment.jsx b/webapp/components/create_comment.jsx index 8f4130afb..c7dbd0717 100644 --- a/webapp/components/create_comment.jsx +++ b/webapp/components/create_comment.jsx @@ -209,6 +209,8 @@ export default class CreateComment extends React.Component { (err) => { if (err.id === 'api.post.create_post.root_id.app_error') { this.showPostDeletedModal(); + PostStore.removePendingPost(post.channel_id, post.pending_post_id); + this.setState({message: post.message}); } else { this.forceUpdate(); } diff --git a/webapp/components/post_deleted_modal.jsx b/webapp/components/post_deleted_modal.jsx index 85be61b2e..f70edf783 100644 --- a/webapp/components/post_deleted_modal.jsx +++ b/webapp/components/post_deleted_modal.jsx @@ -1,13 +1,8 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; -import Constants from 'utils/constants.jsx'; - import {FormattedMessage} from 'react-intl'; -var ActionTypes = Constants.ActionTypes; - import {Modal} from 'react-bootstrap'; import React from 'react'; @@ -26,23 +21,6 @@ export default class PostDeletedModal extends React.Component { handleHide(e) { e.preventDefault(); - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_SEARCH, - results: null - }); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_SEARCH_TERM, - term: null, - do_search: false, - is_mention_search: false - }); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_POST_SELECTED, - postId: null - }); - this.props.onHide(); } -- cgit v1.2.3-1-g7c22