Merge branch 'codex/fix/pending-escape-board-redirect'

# Conflicts:
#	src/components/post-form/post-form.tsx
This commit is contained in:
Tommaso Casaburi
2026-05-23 17:26:47 +07:00
5 changed files with 88 additions and 12 deletions
@@ -906,7 +906,7 @@ describe('PostForm', () => {
await flushEffects();
expect(testState.resetPublishPostOptionsMock).toHaveBeenCalledTimes(1);
expect(testState.navigateMock).toHaveBeenCalledWith('/pending/7');
expect(testState.navigateMock).toHaveBeenCalledWith('/pending/7', { state: { boardPath: 'mu' } });
});
it('redirects new posts to the board index when nonoko is used', async () => {
+3 -2
View File
@@ -431,6 +431,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;
@@ -556,10 +557,10 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
if (nonokoRedirectPath) {
navigate(nonokoRedirectPath, { state: getNonokoPendingRouteState(postIndex) });
} else {
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);