2021-07-19 23:22:39 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import { Modal } from 'modal/modal';
|
|
|
|
import Button from 'component/button';
|
|
|
|
import Card from 'component/common/card';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
commentId: string, // sha256 digest identifying the comment
|
2021-11-08 18:22:40 +01:00
|
|
|
deleterClaim: Claim,
|
|
|
|
deleterIsModOrAdmin?: boolean,
|
|
|
|
creatorClaim?: Claim,
|
2021-07-19 23:22:39 +02:00
|
|
|
supportAmount?: any,
|
2021-08-27 12:29:58 +02:00
|
|
|
setQuickReply: (any) => void,
|
2021-11-08 18:22:40 +01:00
|
|
|
// --- redux ---
|
|
|
|
doHideModal: () => void,
|
|
|
|
doCommentAbandon: (string, Claim, ?boolean, ?Claim) => void,
|
2021-07-19 23:22:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function ModalRemoveComment(props: Props) {
|
2021-08-27 12:29:58 +02:00
|
|
|
const {
|
|
|
|
commentId,
|
2021-11-08 18:22:40 +01:00
|
|
|
deleterClaim,
|
|
|
|
deleterIsModOrAdmin,
|
|
|
|
creatorClaim,
|
2021-08-27 12:29:58 +02:00
|
|
|
supportAmount,
|
|
|
|
setQuickReply,
|
2021-11-08 18:22:40 +01:00
|
|
|
doHideModal,
|
|
|
|
doCommentAbandon,
|
2021-08-27 12:29:58 +02:00
|
|
|
} = props;
|
2021-07-19 23:22:39 +02:00
|
|
|
|
|
|
|
return (
|
2021-11-08 18:22:40 +01:00
|
|
|
<Modal isOpen contentLabel={__('Confirm Comment Deletion')} type="card" onAborted={doHideModal}>
|
2021-07-19 23:22:39 +02:00
|
|
|
<Card
|
|
|
|
title={__('Remove Comment')}
|
|
|
|
body={
|
|
|
|
<React.Fragment>
|
|
|
|
<p>{__('Are you sure you want to remove this comment?')}</p>
|
|
|
|
{Boolean(supportAmount) && (
|
2021-08-27 12:29:58 +02:00
|
|
|
<p className="help error__text">
|
|
|
|
{__('This comment has a tip associated with it which cannot be reverted.')}
|
|
|
|
</p>
|
2021-07-19 23:22:39 +02:00
|
|
|
)}
|
|
|
|
</React.Fragment>
|
|
|
|
}
|
|
|
|
actions={
|
|
|
|
<>
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
label={__('Remove')}
|
|
|
|
onClick={() => {
|
2021-11-08 18:22:40 +01:00
|
|
|
doHideModal();
|
|
|
|
doCommentAbandon(commentId, deleterClaim, deleterIsModOrAdmin, creatorClaim);
|
|
|
|
if (setQuickReply) {
|
|
|
|
setQuickReply(undefined);
|
|
|
|
}
|
2021-07-19 23:22:39 +02:00
|
|
|
}}
|
|
|
|
/>
|
2021-11-08 18:22:40 +01:00
|
|
|
<Button button="link" label={__('Cancel')} onClick={doHideModal} />
|
2021-07-19 23:22:39 +02:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ModalRemoveComment;
|