fix(pending-post): return to board after abandoned challenge

This commit is contained in:
Tommaso Casaburi
2026-05-23 17:24:22 +07:00
parent f4965ee678
commit e95dcb8af5
5 changed files with 88 additions and 12 deletions
+3 -2
View File
@@ -428,6 +428,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const subscriptions = account?.subscriptions || [];
const directories = useDirectories();
const directoryEntry = useDirectoryByAddress(effectiveBoardAddress);
const pendingPostBoardPath = effectiveBoardAddress ? getBoardPath(effectiveBoardAddress, directories) : undefined;
const rulesPath = effectiveBoardAddress ? `/rules/${getBoardPath(effectiveBoardAddress, directories)}` : '/rules';
const showSpoilerForPost = directoryEntry?.features?.noSpoilers !== true;
const showSpoilerForReply = directoryEntry?.features?.noSpoilerReplies !== true;
@@ -538,9 +539,9 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
if (typeof postIndex === 'number') {
resetPublishPostOptions();
resetFields();
navigate(`/pending/${postIndex}`);
navigate(`/pending/${postIndex}`, pendingPostBoardPath ? { state: { boardPath: pendingPostBoardPath } } : undefined);
}
}, [postIndex, resetPublishPostOptions, navigate]);
}, [postIndex, pendingPostBoardPath, resetPublishPostOptions, navigate]);
// in post page, publish a reply to the post
const isInPostView = isPostPageView(location.pathname, params);