mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
limit parentCid logic to first ReplyModal opening
This commit is contained in:
@@ -55,6 +55,7 @@ const All = () => {
|
|||||||
setIsAuthorEdit,
|
setIsAuthorEdit,
|
||||||
setIsCaptchaOpen,
|
setIsCaptchaOpen,
|
||||||
isModerationOpen, setIsModerationOpen,
|
isModerationOpen, setIsModerationOpen,
|
||||||
|
setReplyQuoteCid,
|
||||||
setResolveCaptchaPromise,
|
setResolveCaptchaPromise,
|
||||||
setSelectedAddress,
|
setSelectedAddress,
|
||||||
setSelectedParentCid,
|
setSelectedParentCid,
|
||||||
@@ -702,11 +703,15 @@ const All = () => {
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(thread.shortCid);
|
|
||||||
setSelectedParentCid(thread.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(thread.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}
|
}} title="Reply to this post">{thread.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
p/
|
p/
|
||||||
@@ -983,10 +988,14 @@ const All = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(reply.shortCid);
|
|
||||||
setSelectedParentCid(reply.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(reply.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}</Link>
|
}} title="Reply to this post">{reply.shortCid}</Link>
|
||||||
) : (
|
) : (
|
||||||
<PendingLabel key="pending" commentIndex={reply.index} />
|
<PendingLabel key="pending" commentIndex={reply.index} />
|
||||||
@@ -1513,10 +1522,14 @@ const All = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(thread.shortCid);
|
|
||||||
setSelectedParentCid(thread.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(thread.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}
|
}} title="Reply to this post">{thread.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
@@ -1686,10 +1699,14 @@ const All = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(reply.shortCid);
|
|
||||||
setSelectedParentCid(reply.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(reply.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}
|
}} title="Reply to this post">{reply.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const Board = () => {
|
|||||||
setModeratingCommentCid,
|
setModeratingCommentCid,
|
||||||
setPendingComment,
|
setPendingComment,
|
||||||
setPendingCommentIndex,
|
setPendingCommentIndex,
|
||||||
|
setReplyQuoteCid,
|
||||||
setResolveCaptchaPromise,
|
setResolveCaptchaPromise,
|
||||||
selectedAddress, setSelectedAddress,
|
selectedAddress, setSelectedAddress,
|
||||||
setSelectedParentCid,
|
setSelectedParentCid,
|
||||||
@@ -1148,9 +1149,13 @@ const Board = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedShortCid(thread.shortCid);
|
setReplyQuoteCid(thread.shortCid)
|
||||||
setSelectedParentCid(thread.cid);
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}</Link>
|
}} title="Reply to this post">{thread.shortCid}</Link>
|
||||||
|
|
||||||
{thread.pinned ? (
|
{thread.pinned ? (
|
||||||
@@ -1426,9 +1431,13 @@ const Board = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedShortCid(reply.shortCid);
|
setReplyQuoteCid(reply.shortCid)
|
||||||
setSelectedParentCid(reply.cid);
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}</Link>
|
}} title="Reply to this post">{reply.shortCid}</Link>
|
||||||
) : (
|
) : (
|
||||||
<PendingLabel key="pending" commentIndex={reply.index} />
|
<PendingLabel key="pending" commentIndex={reply.index} />
|
||||||
@@ -1927,9 +1936,13 @@ const Board = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedShortCid(thread.shortCid);
|
setReplyQuoteCid(thread.shortCid)
|
||||||
setSelectedParentCid(thread.cid);
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}
|
}} title="Reply to this post">{thread.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
@@ -2078,9 +2091,13 @@ const Board = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedShortCid(reply.shortCid);
|
setReplyQuoteCid(reply.shortCid)
|
||||||
setSelectedParentCid(reply.cid);
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}
|
}} title="Reply to this post">{reply.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ const Subscriptions = () => {
|
|||||||
setIsAuthorEdit,
|
setIsAuthorEdit,
|
||||||
setIsCaptchaOpen,
|
setIsCaptchaOpen,
|
||||||
isModerationOpen, setIsModerationOpen,
|
isModerationOpen, setIsModerationOpen,
|
||||||
|
setReplyQuoteCid,
|
||||||
setResolveCaptchaPromise,
|
setResolveCaptchaPromise,
|
||||||
setSelectedAddress,
|
setSelectedAddress,
|
||||||
setSelectedParentCid,
|
setSelectedParentCid,
|
||||||
@@ -711,10 +712,14 @@ const Subscriptions = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(thread.shortCid);
|
|
||||||
setSelectedParentCid(thread.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(thread.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}
|
}} title="Reply to this post">{thread.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
p/
|
p/
|
||||||
@@ -991,10 +996,14 @@ const Subscriptions = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(reply.shortCid);
|
|
||||||
setSelectedParentCid(reply.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(reply.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}</Link>
|
}} title="Reply to this post">{reply.shortCid}</Link>
|
||||||
) : (
|
) : (
|
||||||
<PendingLabel key="pending" commentIndex={reply.index} />
|
<PendingLabel key="pending" commentIndex={reply.index} />
|
||||||
@@ -1521,10 +1530,14 @@ const Subscriptions = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(thread.shortCid);
|
|
||||||
setSelectedParentCid(thread.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(thread.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(thread.shortCid);
|
||||||
|
setSelectedParentCid(thread.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{thread.shortCid}
|
}} title="Reply to this post">{thread.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
@@ -1694,10 +1707,14 @@ const Subscriptions = () => {
|
|||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setSelectedThreadCid(thread.cid);
|
setSelectedThreadCid(thread.cid);
|
||||||
setIsReplyOpen(true);
|
|
||||||
setSelectedShortCid(reply.shortCid);
|
|
||||||
setSelectedParentCid(reply.cid);
|
|
||||||
setSelectedAddress(thread.subplebbitAddress);
|
setSelectedAddress(thread.subplebbitAddress);
|
||||||
|
if (isReplyOpen) {
|
||||||
|
setReplyQuoteCid(reply.shortCid)
|
||||||
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}
|
}} title="Reply to this post">{reply.shortCid}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const Thread = () => {
|
|||||||
isModerationOpen, setIsModerationOpen,
|
isModerationOpen, setIsModerationOpen,
|
||||||
isSettingsOpen, setIsSettingsOpen,
|
isSettingsOpen, setIsSettingsOpen,
|
||||||
setModeratingCommentCid,
|
setModeratingCommentCid,
|
||||||
|
setReplyQuoteCid,
|
||||||
setResolveCaptchaPromise,
|
setResolveCaptchaPromise,
|
||||||
setPendingComment,
|
setPendingComment,
|
||||||
setPendingCommentIndex,
|
setPendingCommentIndex,
|
||||||
@@ -842,10 +843,13 @@ const Thread = () => {
|
|||||||
<span>c/</span>
|
<span>c/</span>
|
||||||
<Link to={() => {}} id="reply-button" style={{ cursor: 'pointer' }}
|
<Link to={() => {}} id="reply-button" style={{ cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedParentCid(comment.cid);
|
setReplyQuoteCid(comment.shortCid);
|
||||||
setSelectedShortCid(comment.shortCid);
|
} else {
|
||||||
}} title="Reply to this post">{comment.shortCid}</Link>
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(comment.shortCid);
|
||||||
|
setSelectedParentCid(comment.cid);
|
||||||
|
}}} title="Reply to this post">{comment.shortCid}</Link>
|
||||||
</span>
|
</span>
|
||||||
{comment.pinned ? (
|
{comment.pinned ? (
|
||||||
<>
|
<>
|
||||||
@@ -1079,9 +1083,13 @@ const Thread = () => {
|
|||||||
{reply.shortCid ? (
|
{reply.shortCid ? (
|
||||||
<Link id="reply-button" key={`pl2-${index}`}
|
<Link id="reply-button" key={`pl2-${index}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedParentCid(reply.cid);
|
setReplyQuoteCid(reply.shortCid);
|
||||||
setSelectedShortCid(reply.shortCid);
|
} else {
|
||||||
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}
|
||||||
}} title="Reply to this post">{reply.shortCid}</Link>
|
}} title="Reply to this post">{reply.shortCid}</Link>
|
||||||
) : (
|
) : (
|
||||||
<PendingLabel key="pending" commentIndex={reply.index} />
|
<PendingLabel key="pending" commentIndex={reply.index} />
|
||||||
@@ -1452,10 +1460,13 @@ const Thread = () => {
|
|||||||
<span key={`mob-no-${comment.cid}`}>c/</span>
|
<span key={`mob-no-${comment.cid}`}>c/</span>
|
||||||
<Link to={() => {}} id="reply-button" key={`mob-no2-${comment.cid}`} title="Reply to this post"
|
<Link to={() => {}} id="reply-button" key={`mob-no2-${comment.cid}`} title="Reply to this post"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedParentCid(comment.cid);
|
setReplyQuoteCid(comment.shortCid);
|
||||||
setSelectedShortCid(comment.shortCid);
|
} else {
|
||||||
}}>{comment.shortCid}</Link>
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(comment.shortCid);
|
||||||
|
setSelectedParentCid(comment.cid);
|
||||||
|
}}}>{comment.shortCid}</Link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{commentMediaInfo?.url ? (
|
{commentMediaInfo?.url ? (
|
||||||
@@ -1573,10 +1584,13 @@ const Thread = () => {
|
|||||||
{reply.shortCid ? (
|
{reply.shortCid ? (
|
||||||
<Link id="reply-button" key={`mob-pl2-${index}`}
|
<Link id="reply-button" key={`mob-pl2-${index}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsReplyOpen(true);
|
if (isReplyOpen) {
|
||||||
setSelectedParentCid(reply.cid);
|
setReplyQuoteCid(reply.shortCid);
|
||||||
setSelectedShortCid(reply.shortCid);
|
} else {
|
||||||
}} title="Reply to this post">{reply.shortCid}</Link>
|
setIsReplyOpen(true);
|
||||||
|
setSelectedShortCid(reply.shortCid);
|
||||||
|
setSelectedParentCid(reply.cid);
|
||||||
|
}}} title="Reply to this post">{reply.shortCid}</Link>
|
||||||
) : (
|
) : (
|
||||||
<PendingLabel key="pending-mob" commentIndex={reply.index} />
|
<PendingLabel key="pending-mob" commentIndex={reply.index} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ const useGeneralStore = create((set) => ({
|
|||||||
publishedComment: '',
|
publishedComment: '',
|
||||||
setPublishedComment: (comment) => set({ publishedComment: comment }),
|
setPublishedComment: (comment) => set({ publishedComment: comment }),
|
||||||
|
|
||||||
|
replyQuoteCid: '',
|
||||||
|
setReplyQuoteCid: (cid) => set({ replyQuoteCid: cid }),
|
||||||
|
|
||||||
resolveCaptchaPromise: null,
|
resolveCaptchaPromise: null,
|
||||||
setResolveCaptchaPromise: (resolve) => set({ resolveCaptchaPromise: resolve }),
|
setResolveCaptchaPromise: (resolve) => set({ resolveCaptchaPromise: resolve }),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user