From 4cdadd222ecfc5f09df38d468281c8e5b6ed58b0 Mon Sep 17 00:00:00 2001 From: Tobias Hahnen Date: Thu, 4 Jan 2024 17:13:12 +0100 Subject: [PATCH] SONAR-21403: Remove "login" field for SonarLint The "login" field is not required for the "Open in IDE" feature for revoking the token when no connected mode established. --- .../main/js/apps/issues/components/IssueOpenInIdeButton.tsx | 1 - .../components/__tests__/IssueOpenInIdeButton-test.tsx | 2 -- .../src/main/js/helpers/__tests__/sonarlint-test.ts | 6 +----- server/sonar-web/src/main/js/helpers/sonarlint.ts | 5 +---- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueOpenInIdeButton.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueOpenInIdeButton.tsx index 2c80313ae43..8a1ab07731c 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueOpenInIdeButton.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueOpenInIdeButton.tsx @@ -97,7 +97,6 @@ export function IssueOpenInIdeButton({ branchName, calledPort: ide.port, issueKey, - login, projectKey, pullRequestID, tokenName: token.name, diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssueOpenInIdeButton-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssueOpenInIdeButton-test.tsx index da9396e0453..5109e4a9429 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssueOpenInIdeButton-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssueOpenInIdeButton-test.tsx @@ -132,7 +132,6 @@ it('handles button click with one ide found', async () => { branchName: undefined, calledPort: MOCK_IDES[0].port, issueKey: MOCK_ISSUE_KEY, - login: 'login-1', projectKey: MOCK_PROJECT_KEY, pullRequestID: undefined, tokenName: undefined, @@ -181,7 +180,6 @@ it('handles button click with several ides found', async () => { branchName: undefined, calledPort: MOCK_IDES[1].port, issueKey: MOCK_ISSUE_KEY, - login: 'login-1', projectKey: MOCK_PROJECT_KEY, pullRequestID: undefined, tokenName: 'token name', diff --git a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts index b16d3026023..ef2234a25a8 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts @@ -95,7 +95,6 @@ describe('openHotspot', () => { describe('openIssue', () => { it('should send the correct request to the IDE to open an issue', async () => { let branchName: string | undefined = undefined; - let login: string | undefined = undefined; let pullRequestID: string | undefined = undefined; let tokenName: string | undefined = undefined; let tokenValue: string | undefined = undefined; @@ -114,8 +113,6 @@ describe('openIssue', () => { // eslint-disable-next-line jest/no-conditional-in-test expect(calledUrl.searchParams.get('pullRequest') ?? undefined).toStrictEqual(pullRequestID); // eslint-disable-next-line jest/no-conditional-in-test - expect(calledUrl.searchParams.get('login') ?? undefined).toStrictEqual(login); - // eslint-disable-next-line jest/no-conditional-in-test expect(calledUrl.searchParams.get('tokenName') ?? undefined).toStrictEqual(tokenName); // eslint-disable-next-line jest/no-conditional-in-test expect(calledUrl.searchParams.get('tokenValue') ?? undefined).toStrictEqual(tokenValue); @@ -148,10 +145,9 @@ describe('openIssue', () => { pullRequestID = 'pr-1'; await testWith({ pullRequestID }); - login = 'login-1'; tokenName = 'token-name'; tokenValue = 'token-value'; - await testWith({ login, tokenName, tokenValue }); + await testWith({ tokenName, tokenValue }); }); }); diff --git a/server/sonar-web/src/main/js/helpers/sonarlint.ts b/server/sonar-web/src/main/js/helpers/sonarlint.ts index 231da2aeca3..d187ae35b7a 100644 --- a/server/sonar-web/src/main/js/helpers/sonarlint.ts +++ b/server/sonar-web/src/main/js/helpers/sonarlint.ts @@ -97,7 +97,6 @@ export function openIssue({ branchName, calledPort, issueKey, - login, projectKey, pullRequestID, tokenName, @@ -106,7 +105,6 @@ export function openIssue({ branchName?: string; calledPort: number; issueKey: string; - login?: string; projectKey: string; pullRequestID?: string; tokenName?: string; @@ -126,8 +124,7 @@ export function openIssue({ showUrl.searchParams.set('pullRequest', pullRequestID); } - if (login !== undefined && tokenName !== undefined && tokenValue !== undefined) { - showUrl.searchParams.set('login', login); + if (tokenName !== undefined && tokenValue !== undefined) { showUrl.searchParams.set('tokenName', tokenName); showUrl.searchParams.set('tokenValue', tokenValue); } -- 2.39.5