diff --git a/webapp/channels/src/components/post/index.tsx b/webapp/channels/src/components/post/index.tsx index 8ac03cbb63..40befa14d2 100644 --- a/webapp/channels/src/components/post/index.tsx +++ b/webapp/channels/src/components/post/index.tsx @@ -30,7 +30,7 @@ import {getIsMobileView} from 'selectors/views/browser'; import {GlobalState} from 'types/store'; import {isArchivedChannel} from 'utils/channel_utils'; -import {areConsecutivePostsBySameUser, shouldShowActionsMenu, shouldShowDotMenu} from 'utils/post_utils'; +import {areConsecutivePostsBySameUser, canDeletePost, shouldShowActionsMenu, shouldShowDotMenu} from 'utils/post_utils'; import {Locations, Preferences, RHSStates} from 'utils/constants'; import {ExtendedPost, removePost} from 'mattermost-redux/actions/posts'; @@ -228,6 +228,7 @@ function makeMapStateToProps() { isPostPriorityEnabled: isPostPriorityEnabled(state), isCardOpen: selectedCard && selectedCard.id === post.id, shouldShowDotMenu: shouldShowDotMenu(state, post, channel), + canDelete: canDeletePost(state, post, channel), }; }; } diff --git a/webapp/channels/src/components/post/post_component.tsx b/webapp/channels/src/components/post/post_component.tsx index 8bf09f84c0..1b8c0e5335 100644 --- a/webapp/channels/src/components/post/post_component.tsx +++ b/webapp/channels/src/components/post/post_component.tsx @@ -117,6 +117,7 @@ export type Props = { isPostAcknowledgementsEnabled: boolean; isPostPriorityEnabled: boolean; isCardOpen?: boolean; + canDelete?: boolean; }; const PostComponent = (props: Props): JSX.Element => { diff --git a/webapp/channels/src/components/post/post_options.tsx b/webapp/channels/src/components/post/post_options.tsx index dedbcc7d9a..fac2f3a168 100644 --- a/webapp/channels/src/components/post/post_options.tsx +++ b/webapp/channels/src/components/post/post_options.tsx @@ -50,6 +50,7 @@ type Props = { shortcutReactToLastPostEmittedFrom?: string; isPostHeaderVisible?: boolean | null; isPostBeingEdited?: boolean; + canDelete?: boolean; actions: { emitShortcutReactToLastPostFrom: (emittedFrom: 'CENTER' | 'RHS_ROOT' | 'NO_WHERE') => void; }; @@ -201,7 +202,7 @@ const PostOptions = (props: Props): JSX.Element => { ); - } else if (isPostDeleted) { + } else if (isPostDeleted || (systemMessage && !props.canDelete)) { options = null; } else if (props.location === Locations.SEARCH) { const hasCRTFooter = props.collapsedThreadsEnabled && !post.root_id && (post.reply_count > 0 || post.is_following);