diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-03 15:19:46 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-04 10:35:13 +0200 |
commit | 20245b9a34839033be4788155601204bdf054478 (patch) | |
tree | b30dd352b345e95b5c752aa5b182dd4090cc2c55 /server/sonar-web/src/main/js/components/issue | |
parent | 912be3d929359d3de7acd687356c82c395cc8f84 (diff) | |
download | sonarqube-20245b9a34839033be4788155601204bdf054478.tar.gz sonarqube-20245b9a34839033be4788155601204bdf054478.zip |
fix issue permalinks with branches
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue')
5 files changed, 19 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/Issue.js b/server/sonar-web/src/main/js/components/issue/Issue.js index a67e04c3faf..47889911316 100644 --- a/server/sonar-web/src/main/js/components/issue/Issue.js +++ b/server/sonar-web/src/main/js/components/issue/Issue.js @@ -29,6 +29,7 @@ import { updateIssue } from './actions'; /*:: type Props = {| + branch?: string, checked?: boolean, displayLocationsCount?: boolean; displayLocationsLink?: boolean; @@ -146,6 +147,7 @@ export default class Issue extends React.PureComponent { render() { return ( <IssueView + branch={this.props.branch} checked={this.props.checked} currentPopup={this.props.openPopup} displayLocationsCount={this.props.displayLocationsCount} diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.js b/server/sonar-web/src/main/js/components/issue/IssueView.js index fd6b8f2aa6d..5141e4d8032 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.js +++ b/server/sonar-web/src/main/js/components/issue/IssueView.js @@ -29,6 +29,7 @@ import { deleteIssueComment, editIssueComment } from '../../api/issues'; /*:: type Props = {| + branch?: string, checked?: boolean, currentPopup: ?string, displayLocationsCount?: boolean; @@ -89,6 +90,7 @@ export default class IssueView extends React.PureComponent { role="listitem" tabIndex={0}> <IssueTitleBar + branch={this.props.branch} currentPopup={this.props.currentPopup} displayLocationsCount={this.props.displayLocationsCount} displayLocationsLink={this.props.displayLocationsLink} diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js index bd4acefaa84..a445f5c1523 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js @@ -33,6 +33,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; /*:: type Props = {| + branch?: string, currentPopup: ?string, displayLocationsCount?: boolean; displayLocationsLink?: boolean; @@ -66,7 +67,11 @@ export default function IssueTitleBar(props /*: Props */) { const displayLocations = props.displayLocationsCount && locationsCount > 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 ( <table className="issue-table"> 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( - <IssueTitleBar issue={issue} currentPopup={null} onFail={jest.fn()} togglePopup={jest.fn()} /> + <IssueTitleBar + branch="feature-1.0" + issue={issue} + currentPopup={null} + onFail={jest.fn()} + togglePopup={jest.fn()} + /> ); 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", |