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 ---
|
// --- select ---
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
contentChannelPermanentUrl: any,
|
|
||||||
activeChannelClaim: ?ChannelClaim,
|
activeChannelClaim: ?ChannelClaim,
|
||||||
playingUri: ?PlayingUri,
|
playingUri: ?PlayingUri,
|
||||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||||
|
@ -44,7 +43,6 @@ function CommentMenuList(props: Props) {
|
||||||
commentIsMine,
|
commentIsMine,
|
||||||
commentId,
|
commentId,
|
||||||
activeChannelClaim,
|
activeChannelClaim,
|
||||||
contentChannelPermanentUrl,
|
|
||||||
isTopLevel,
|
isTopLevel,
|
||||||
isPinned,
|
isPinned,
|
||||||
playingUri,
|
playingUri,
|
||||||
|
@ -62,6 +60,8 @@ function CommentMenuList(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const contentChannelClaim = getChannelFromClaim(claim);
|
const contentChannelClaim = getChannelFromClaim(claim);
|
||||||
|
const contentChannelPermanentUrl = contentChannelClaim && contentChannelClaim.permanent_url;
|
||||||
|
|
||||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||||
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
||||||
|
@ -75,10 +75,12 @@ function CommentMenuList(props: Props) {
|
||||||
if (playingUri && playingUri.source === 'comment') {
|
if (playingUri && playingUri.source === 'comment') {
|
||||||
clearPlayingUri();
|
clearPlayingUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
||||||
commentId,
|
commentId,
|
||||||
commentIsMine,
|
deleterClaim: activeChannelClaim,
|
||||||
contentChannelPermanentUrl,
|
deleterIsModOrAdmin: activeChannelIsAdmin || activeChannelIsModerator,
|
||||||
|
creatorClaim: commentIsMine ? undefined : contentChannelClaim,
|
||||||
supportAmount,
|
supportAmount,
|
||||||
setQuickReply,
|
setQuickReply,
|
||||||
});
|
});
|
||||||
|
@ -183,7 +185,9 @@ function CommentMenuList(props: Props) {
|
||||||
|
|
||||||
{!disableRemove &&
|
{!disableRemove &&
|
||||||
activeChannelClaim &&
|
activeChannelClaim &&
|
||||||
(activeChannelClaim.permanent_url === authorUri ||
|
(activeChannelIsModerator ||
|
||||||
|
activeChannelIsAdmin ||
|
||||||
|
activeChannelClaim.permanent_url === authorUri ||
|
||||||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
|
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
|
||||||
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
|
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
|
||||||
<div className="menu__link">
|
<div className="menu__link">
|
||||||
|
|
Loading…
Reference in a new issue