mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix moderation modal state
This commit is contained in:
@@ -22,9 +22,9 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
|
||||
|
||||
const comment = useComment({commentCid: moderatingCommentCid});
|
||||
|
||||
const [pin, setPin] = useState(comment?.pinned);
|
||||
const [pin, setPin] = useState(comment.pinned);
|
||||
const [deleteThread, setDeleteThread] = useState(deletePost);
|
||||
const [close, setClose] = useState(comment?.locked);
|
||||
const [close, setClose] = useState(comment.locked);
|
||||
const [reason, setReason] = useState('');
|
||||
const [triggerPublishCommentEdit, setTriggerPublishCommentEdit] = useState(false);
|
||||
|
||||
@@ -32,16 +32,24 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
|
||||
const [, setNewSuccessMessage] = useSuccess();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setPin(comment.pinned);
|
||||
setClose(comment.locked);
|
||||
}, [comment]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setDeleteThread(deletePost);
|
||||
}, [deletePost]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
setDeleteThread(deletePost);
|
||||
}
|
||||
}, [isOpen, deletePost]);
|
||||
|
||||
|
||||
const handleCloseModal = () => {
|
||||
setDeleteThread(false);
|
||||
closeModal();
|
||||
|
||||
@@ -82,7 +82,7 @@ export const StyledModal = styled(Modal)`
|
||||
}
|
||||
|
||||
.settings-cat {
|
||||
display: ${({ expanded }) => index => (expanded.includes(index) ? "block" : "none")};
|
||||
display: ${({ expanded }) => index => (expanded?.includes(index) ? "block" : "none")};
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user