Allow admins to delete comments as well. (#250)
This is a follow-up to #235
This commit is contained in:
parent
d884f1ea72
commit
146633a6f0
1 changed files with 9 additions and 5 deletions
|
@ -21,7 +21,6 @@ type Props = {
|
|||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
contentChannelPermanentUrl: any,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
playingUri: ?PlayingUri,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
|
@ -44,7 +43,6 @@ function CommentMenuList(props: Props) {
|
|||
commentIsMine,
|
||||
commentId,
|
||||
activeChannelClaim,
|
||||
contentChannelPermanentUrl,
|
||||
isTopLevel,
|
||||
isPinned,
|
||||
playingUri,
|
||||
|
@ -62,6 +60,8 @@ function CommentMenuList(props: Props) {
|
|||
} = props;
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const contentChannelPermanentUrl = contentChannelClaim && contentChannelClaim.permanent_url;
|
||||
|
||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
||||
|
@ -75,10 +75,12 @@ function CommentMenuList(props: Props) {
|
|||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
||||
commentId,
|
||||
commentIsMine,
|
||||
contentChannelPermanentUrl,
|
||||
deleterClaim: activeChannelClaim,
|
||||
deleterIsModOrAdmin: activeChannelIsAdmin || activeChannelIsModerator,
|
||||
creatorClaim: commentIsMine ? undefined : contentChannelClaim,
|
||||
supportAmount,
|
||||
setQuickReply,
|
||||
});
|
||||
|
@ -183,7 +185,9 @@ function CommentMenuList(props: Props) {
|
|||
|
||||
{!disableRemove &&
|
||||
activeChannelClaim &&
|
||||
(activeChannelClaim.permanent_url === authorUri ||
|
||||
(activeChannelIsModerator ||
|
||||
activeChannelIsAdmin ||
|
||||
activeChannelClaim.permanent_url === authorUri ||
|
||||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
|
||||
<div className="menu__link">
|
||||
|
|
Loading…
Reference in a new issue