fix(quotes): resolve external quote links across boards (#1064)

This commit is contained in:
Tommaso Casaburi
2026-03-12 17:41:11 +08:00
committed by GitHub
parent ef375e3578
commit fe55e6f332
58 changed files with 1719 additions and 92 deletions
+20
View File
@@ -42,6 +42,7 @@ const testState = vi.hoisted(() => ({
paginationFeedPostsPerPage: 6,
},
resetMock: vi.fn(),
registerCommentsMock: vi.fn(),
resolvedSubplebbitAddress: 'music-posting.eth' as string | undefined,
setEnableInfiniteScrollMock: vi.fn(),
setResetFunctionMock: vi.fn(),
@@ -147,6 +148,13 @@ vi.mock('../../../stores/use-feed-view-settings-store', () => ({
}),
}));
vi.mock('../../../stores/use-post-number-store', () => ({
default: (selector: (state: { registerComments: typeof testState.registerCommentsMock }) => unknown) =>
selector({
registerComments: testState.registerCommentsMock,
}),
}));
vi.mock('../../../hooks/use-board-feed-page-size', () => ({
useBoardFeedPageSize: () => testState.pageSizes,
}));
@@ -259,6 +267,7 @@ describe('Board', () => {
};
testState.loadMoreMock.mockReset();
testState.resetMock.mockReset();
testState.registerCommentsMock.mockReset();
testState.setEnableInfiniteScrollMock.mockReset();
testState.setResetFunctionMock.mockReset();
document.title = 'before';
@@ -333,6 +342,17 @@ describe('Board', () => {
expect(latestLocation).toBe('/mu/2');
});
it('registers visible feed posts with the post-number store', async () => {
testState.feed = [
{ cid: 'first-post', subplebbitAddress: 'music-posting.eth' },
{ cid: 'second-post', subplebbitAddress: 'music-posting.eth' },
];
await renderBoard({ initialEntry: '/mu', routePath: '/:boardIdentifier/*' });
expect(testState.registerCommentsMock).toHaveBeenCalledWith(testState.feed);
});
it('canonicalizes multiboard paths and shows the subscriptions empty state', async () => {
testState.account = { subscriptions: [] };
testState.filteredDirectoryAddresses = [];