From ab38a8fbd7b305028527751c4f1fb3f5dcc97d53 Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 21 Jul 2023 08:58:05 -0600 Subject: [PATCH] MM-50382 Shows an error if post edit history fails to load (#22828) --- .../src/components/edit_post/edit_post.tsx | 4 - .../src/components/edit_post/index.ts | 3 +- .../post_edit_history.test.tsx.snap | 500 ++++++++++++++---- .../src/components/post_edit_history/index.ts | 2 - .../post_edit_history/post_edit_history.scss | 34 ++ .../post_edit_history.test.tsx | 44 +- .../post_edit_history/post_edit_history.tsx | 86 ++- .../post_view/post_edited_indicator/index.ts | 3 - .../post_edited_indicator.tsx | 1 - webapp/channels/src/i18n/en.json | 2 + 10 files changed, 525 insertions(+), 154 deletions(-) create mode 100644 webapp/channels/src/components/post_edit_history/post_edit_history.scss diff --git a/webapp/channels/src/components/edit_post/edit_post.tsx b/webapp/channels/src/components/edit_post/edit_post.tsx index e4a5a92f00..81e6e570b3 100644 --- a/webapp/channels/src/components/edit_post/edit_post.tsx +++ b/webapp/channels/src/components/edit_post/edit_post.tsx @@ -42,7 +42,6 @@ export type Actions = { unsetEditingPost: () => void; openModal: (input: ModalData) => void; scrollPostListToBottom: () => void; - getPostEditHistory: (postId: string) => void; } export type Props = { @@ -271,9 +270,6 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, } await actions.editPost(updatedPost as Post); - if (rest.isRHSOpened && rest.isEditHistoryShowing) { - actions.getPostEditHistory(editingPost.postId || ''); - } handleAutomatedRefocusAndExit(); }; diff --git a/webapp/channels/src/components/edit_post/index.ts b/webapp/channels/src/components/edit_post/index.ts index 16310d9a12..78e7a7aac3 100644 --- a/webapp/channels/src/components/edit_post/index.ts +++ b/webapp/channels/src/components/edit_post/index.ts @@ -4,7 +4,7 @@ import {connect} from 'react-redux'; import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; -import {addMessageIntoHistory, getPostEditHistory} from 'mattermost-redux/actions/posts'; +import {addMessageIntoHistory} from 'mattermost-redux/actions/posts'; import {Preferences, Permissions} from 'mattermost-redux/constants'; import {getConfig} from 'mattermost-redux/selectors/entities/general'; import {getChannel} from 'mattermost-redux/selectors/entities/channels'; @@ -67,7 +67,6 @@ function mapDispatchToProps(dispatch: Dispatch) { setDraft: setGlobalItem, unsetEditingPost, openModal, - getPostEditHistory, }, dispatch), }; } diff --git a/webapp/channels/src/components/post_edit_history/__snapshots__/post_edit_history.test.tsx.snap b/webapp/channels/src/components/post_edit_history/__snapshots__/post_edit_history.test.tsx.snap index fd443bcf0d..8855c71414 100644 --- a/webapp/channels/src/components/post_edit_history/__snapshots__/post_edit_history.test.tsx.snap +++ b/webapp/channels/src/components/post_edit_history/__snapshots__/post_edit_history.test.tsx.snap @@ -1,125 +1,391 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`components/post_edit_history should match snapshot 1`] = ` -
- +