From 20245b9a34839033be4788155601204bdf054478 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 3 Oct 2017 15:19:46 +0200 Subject: [PATCH] fix issue permalinks with branches --- .../src/main/js/apps/issues/components/ListItem.js | 1 + .../main/js/components/SourceViewer/SourceViewerBase.js | 1 + .../main/js/components/SourceViewer/SourceViewerCode.js | 2 ++ .../main/js/components/SourceViewer/components/Line.js | 2 ++ .../js/components/SourceViewer/components/LineCode.js | 2 ++ .../components/SourceViewer/components/LineIssuesList.js | 4 +++- server/sonar-web/src/main/js/components/issue/Issue.js | 2 ++ .../sonar-web/src/main/js/components/issue/IssueView.js | 2 ++ .../main/js/components/issue/components/IssueTitleBar.js | 7 ++++++- .../issue/components/__tests__/IssueTitleBar-test.js | 8 +++++++- .../__tests__/__snapshots__/IssueTitleBar-test.js.snap | 2 ++ 11 files changed, 30 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js index 94da47a46ab..7350b468759 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js +++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js @@ -106,6 +106,7 @@ export default class ListItem extends React.PureComponent { )} 0 && sources[0].line > 1; return ( 0 && ( , @@ -39,12 +40,13 @@ export default class LineIssuesList extends React.PureComponent { /*:: props: Props; */ render() { - const { issues, onIssueClick, openPopup, selectedIssue } = this.props; + const { branch, issues, onIssueClick, openPopup, selectedIssue } = this.props; return (
{issues.map(issue => ( 0; - const issueUrl = getComponentIssuesUrl(issue.project, { issues: issue.key, open: issue.key }); + const issueUrl = getComponentIssuesUrl(issue.project, { + branch: props.branch, + issues: issue.key, + open: issue.key + }); return ( diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js index bf2980f0c2d..f77de286ed3 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js @@ -47,7 +47,13 @@ const issueWithLocations = { it('should render the titlebar correctly', () => { const element = shallow( - + ); expect(element).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap index 1302c5f2ac0..18d585695f7 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap @@ -80,6 +80,7 @@ exports[`should render the titlebar correctly 1`] = ` Object { "pathname": "/project/issues", "query": Object { + "branch": "feature-1.0", "id": "myproject", "issues": "AVsae-CQS-9G3txfbFN2", "open": "AVsae-CQS-9G3txfbFN2", @@ -169,6 +170,7 @@ exports[`should render the titlebar with the filter 1`] = ` Object { "pathname": "/project/issues", "query": Object { + "branch": undefined, "id": "myproject", "issues": "AVsae-CQS-9G3txfbFN2", "open": "AVsae-CQS-9G3txfbFN2", -- 2.39.5