aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>2024-11-26 11:47:25 +0100
committersonartech <sonartech@sonarsource.com>2024-11-26 20:02:51 +0000
commitb0346114b8eebc086def01b0b904ad3069ddc2ee (patch)
treed09796548cd4fc93ef88ac8bbbe8bedfae3fc8b8 /server/sonar-web
parent93a679d6baa183b111efe131ef178e90c567a495 (diff)
downloadsonarqube-b0346114b8eebc086def01b0b904ad3069ddc2ee.tar.gz
sonarqube-b0346114b8eebc086def01b0b904ad3069ddc2ee.zip
SONAR-23758 No longer alter doc link root provided by the server for local builds
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/DocumentationRedirect-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/helpers/docs.ts10
2 files changed, 3 insertions, 16 deletions
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/DocumentationRedirect-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/DocumentationRedirect-test.tsx
index 7548030891f..baaf4d89f6c 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/DocumentationRedirect-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/DocumentationRedirect-test.tsx
@@ -33,15 +33,6 @@ it('should redirect to static doc for specific version', async () => {
);
});
-it('should redirect to static doc for latest version', async () => {
- renderDocumentationRedirect('land', '10.0-SNAPSHOT');
-
- expect(await screen.findByRole('link')).toHaveAttribute(
- 'href',
- 'https://docs.sonarsource.com/sonarqube/latest/land',
- );
-});
-
function renderDocumentationRedirect(navigate: string, version?: string) {
renderAppRoutes(
`documentation/${navigate}`,
diff --git a/server/sonar-web/src/main/js/helpers/docs.ts b/server/sonar-web/src/main/js/helpers/docs.ts
index ac32f8e5005..32460839c66 100644
--- a/server/sonar-web/src/main/js/helpers/docs.ts
+++ b/server/sonar-web/src/main/js/helpers/docs.ts
@@ -25,19 +25,15 @@ import { DocLink } from './doc-links';
// This is only meant to be used directly for DocumentationRedirect. For all other uses,
// please use useDocUrl instead (it forces the use of a catalogued documentation link)
export function useUncataloguedDocUrl(to?: string) {
- const { version, documentationUrl: docUrl } = React.useContext(AppStateContext);
+ const { documentationUrl: docUrl } = React.useContext(AppStateContext);
const formatDocUrl = React.useCallback(
(href: string) => {
- const isSnapshot = version.indexOf('SNAPSHOT') !== -1;
-
const path = href.replace(/^\//, '');
- return isSnapshot
- ? `${docUrl.replace(docUrl.slice(docUrl.lastIndexOf('/')), '/latest')}/${path}`
- : `${docUrl}/${path}`;
+ return `${docUrl}/${path}`;
},
- [docUrl, version],
+ [docUrl],
);
return to ? formatDocUrl(to) : formatDocUrl;