mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix anon mode
This commit is contained in:
@@ -266,14 +266,6 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
|
||||
publishReply();
|
||||
};
|
||||
|
||||
const hasSetInitialDisplayName = useRef(false);
|
||||
useEffect(() => {
|
||||
if (!hasSetInitialDisplayName.current && displayName) {
|
||||
setPublishReplyOptions({ displayName });
|
||||
hasSetInitialDisplayName.current = true;
|
||||
}
|
||||
}, [displayName, setPublishReplyOptions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof replyIndex === 'number') {
|
||||
resetPublishReplyOptions();
|
||||
|
||||
@@ -39,7 +39,6 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
const address = comment?.author?.address;
|
||||
|
||||
const hasCalledAnonAddressRef = useRef(false);
|
||||
|
||||
const getAnonAddressForReply = useCallback(async () => {
|
||||
if (anonMode && !hasCalledAnonAddressRef.current) {
|
||||
hasCalledAnonAddressRef.current = true;
|
||||
@@ -49,6 +48,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
signer: existingSigner,
|
||||
author: {
|
||||
address: existingSigner.address,
|
||||
displayName: displayName || undefined,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
@@ -57,17 +57,12 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
signer: newSigner,
|
||||
author: {
|
||||
address: newSigner.address,
|
||||
displayName: displayName || undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [anonMode, address, getExistingSigner, getNewSigner, setPublishReplyOptions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (anonMode) {
|
||||
getAnonAddressForReply();
|
||||
}
|
||||
}, [anonMode, getAnonAddressForReply]);
|
||||
}, [address, getExistingSigner, getNewSigner, setPublishReplyOptions, anonMode, displayName]);
|
||||
|
||||
const onPublishReply = () => {
|
||||
const currentContent = textRef.current?.value || '';
|
||||
@@ -86,6 +81,12 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
publishReply();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (anonMode) {
|
||||
getAnonAddressForReply();
|
||||
}
|
||||
}, [anonMode, getAnonAddressForReply]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof replyIndex === 'number') {
|
||||
resetPublishReplyOptions();
|
||||
@@ -93,14 +94,6 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
}
|
||||
}, [replyIndex, resetPublishReplyOptions, closeModal]);
|
||||
|
||||
const hasSetInitialDisplayName = useRef(false);
|
||||
useEffect(() => {
|
||||
if (!hasSetInitialDisplayName.current && displayName) {
|
||||
setPublishReplyOptions({ displayName });
|
||||
hasSetInitialDisplayName.current = true;
|
||||
}
|
||||
}, [displayName, setPublishReplyOptions]);
|
||||
|
||||
const nodeRef = useRef<HTMLDivElement>(null);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user