mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-52444] - Hide dot menu for users when they can't delete a system post (#23487)
Automatic Merge
This commit is contained in:
parent
3ac15290ef
commit
c8ee05fb76
@ -30,7 +30,7 @@ import {getIsMobileView} from 'selectors/views/browser';
|
|||||||
import {GlobalState} from 'types/store';
|
import {GlobalState} from 'types/store';
|
||||||
|
|
||||||
import {isArchivedChannel} from 'utils/channel_utils';
|
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 {Locations, Preferences, RHSStates} from 'utils/constants';
|
||||||
|
|
||||||
import {ExtendedPost, removePost} from 'mattermost-redux/actions/posts';
|
import {ExtendedPost, removePost} from 'mattermost-redux/actions/posts';
|
||||||
@ -228,6 +228,7 @@ function makeMapStateToProps() {
|
|||||||
isPostPriorityEnabled: isPostPriorityEnabled(state),
|
isPostPriorityEnabled: isPostPriorityEnabled(state),
|
||||||
isCardOpen: selectedCard && selectedCard.id === post.id,
|
isCardOpen: selectedCard && selectedCard.id === post.id,
|
||||||
shouldShowDotMenu: shouldShowDotMenu(state, post, channel),
|
shouldShowDotMenu: shouldShowDotMenu(state, post, channel),
|
||||||
|
canDelete: canDeletePost(state, post, channel),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ export type Props = {
|
|||||||
isPostAcknowledgementsEnabled: boolean;
|
isPostAcknowledgementsEnabled: boolean;
|
||||||
isPostPriorityEnabled: boolean;
|
isPostPriorityEnabled: boolean;
|
||||||
isCardOpen?: boolean;
|
isCardOpen?: boolean;
|
||||||
|
canDelete?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const PostComponent = (props: Props): JSX.Element => {
|
const PostComponent = (props: Props): JSX.Element => {
|
||||||
|
@ -50,6 +50,7 @@ type Props = {
|
|||||||
shortcutReactToLastPostEmittedFrom?: string;
|
shortcutReactToLastPostEmittedFrom?: string;
|
||||||
isPostHeaderVisible?: boolean | null;
|
isPostHeaderVisible?: boolean | null;
|
||||||
isPostBeingEdited?: boolean;
|
isPostBeingEdited?: boolean;
|
||||||
|
canDelete?: boolean;
|
||||||
actions: {
|
actions: {
|
||||||
emitShortcutReactToLastPostFrom: (emittedFrom: 'CENTER' | 'RHS_ROOT' | 'NO_WHERE') => void;
|
emitShortcutReactToLastPostFrom: (emittedFrom: 'CENTER' | 'RHS_ROOT' | 'NO_WHERE') => void;
|
||||||
};
|
};
|
||||||
@ -201,7 +202,7 @@ const PostOptions = (props: Props): JSX.Element => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (isPostDeleted) {
|
} else if (isPostDeleted || (systemMessage && !props.canDelete)) {
|
||||||
options = null;
|
options = null;
|
||||||
} else if (props.location === Locations.SEARCH) {
|
} else if (props.location === Locations.SEARCH) {
|
||||||
const hasCRTFooter = props.collapsedThreadsEnabled && !post.root_id && (post.reply_count > 0 || post.is_following);
|
const hasCRTFooter = props.collapsedThreadsEnabled && !post.root_id && (post.reply_count > 0 || post.is_following);
|
||||||
|
Loading…
Reference in New Issue
Block a user