mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-14 09:09:42 +00:00
Don't link page groups in inline link tooltips to their redirecting URL
This commit is contained in:
@@ -627,12 +627,12 @@ describe('resolveContentRef for direct space links', () => {
|
||||
{ label: 'API guides' },
|
||||
{ label: 'Authentification' },
|
||||
{ label: 'Référence', href: targetSiteSpace.urls.published },
|
||||
{ label: 'Getting started', icon: null, href: expect.any(String) },
|
||||
{ label: 'Getting started', icon: null },
|
||||
]);
|
||||
expect(result?.ancestors?.[0]?.href).toBeUndefined();
|
||||
expect(result?.ancestors?.[1]?.href).toBeUndefined();
|
||||
expect(result?.ancestors?.[2]?.href).toBeUndefined();
|
||||
expect(result?.ancestors?.[4]?.href).toBeTruthy();
|
||||
expect(result?.ancestors?.[4]?.href).toBeUndefined();
|
||||
});
|
||||
|
||||
it('uses the first document as the target for a page-group reference', async () => {
|
||||
|
||||
@@ -276,7 +276,11 @@ export async function resolveContentRef(
|
||||
style={iconStyle}
|
||||
/>
|
||||
) : null,
|
||||
href: linker.toPathForPage({ page: ancestor, pages: revision.pages }),
|
||||
// A group's own URL only redirects to its first page.
|
||||
href:
|
||||
ancestor.type === 'group'
|
||||
? undefined
|
||||
: linker.toPathForPage({ page: ancestor, pages: revision.pages }),
|
||||
})) ?? [];
|
||||
if (!page) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user