]> source.dussan.org Git - sonarqube.git/commitdiff
fix issue permalinks with branches
authorStas Vilchik <stas.vilchik@sonarsource.com>
Tue, 3 Oct 2017 13:19:46 +0000 (15:19 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 4 Oct 2017 08:35:13 +0000 (10:35 +0200)
server/sonar-web/src/main/js/apps/issues/components/ListItem.js
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js
server/sonar-web/src/main/js/components/SourceViewer/components/Line.js
server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js
server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js
server/sonar-web/src/main/js/components/issue/Issue.js
server/sonar-web/src/main/js/components/issue/IssueView.js
server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js
server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js
server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap

index 94da47a46ab928d8141d4c0080d4a843d083085f..7350b46875951b9023ddbf15627274c036f81906 100644 (file)
@@ -106,6 +106,7 @@ export default class ListItem extends React.PureComponent {
           </div>
         )}
         <Issue
+          branch={branch}
           checked={this.props.checked}
           displayLocationsLink={false}
           issue={issue}
index 08311dfc7b32e785b0b5029fb2b113ae497ffd1c..afda1bbd764a500fb00525b22067c6f0c1d22e87 100644 (file)
@@ -599,6 +599,7 @@ export default class SourceViewerBase extends React.PureComponent {
     const hasSourcesBefore = sources.length > 0 && sources[0].line > 1;
     return (
       <SourceViewerCode
+        branch={this.props.branch}
         displayAllIssues={this.props.displayAllIssues}
         displayIssueLocationsCount={this.props.displayIssueLocationsCount}
         displayIssueLocationsLink={this.props.displayIssueLocationsLink}
index 779b7a685a9cf65c22f960aa7ce1beef33a55ca5..0c1af3244b9bca360b1aef441490dcd38889bdc8 100644 (file)
@@ -37,6 +37,7 @@ const ZERO_LINE = {
 
 export default class SourceViewerCode extends React.PureComponent {
   /*:: props: {|
+    branch?: string,
     displayAllIssues: boolean,
     displayIssueLocationsCount?: boolean;
     displayIssueLocationsLink?: boolean;
@@ -148,6 +149,7 @@ export default class SourceViewerCode extends React.PureComponent {
 
     return (
       <Line
+        branch={this.props.branch}
         displayAllIssues={this.props.displayAllIssues}
         displayCoverage={displayCoverage}
         displayDuplications={displayDuplications}
index 216f6ef65c1845b638fbad6e9667b019145c118c..a5441d1e81468e6c89d1159ac8450ce32010e5bd 100644 (file)
@@ -34,6 +34,7 @@ import LineCode from './LineCode';
 
 /*::
 type Props = {|
+  branch?: string,
   displayAllIssues: boolean,
   displayCoverage: boolean,
   displayDuplications: boolean,
@@ -144,6 +145,7 @@ export default class Line extends React.PureComponent {
         )}
 
         <LineCode
+          branch={this.props.branch}
           displayIssueLocationsCount={this.props.displayIssueLocationsCount}
           displayIssueLocationsLink={this.props.displayIssueLocationsLink}
           highlightedLocationMessage={this.props.highlightedLocationMessage}
index 3635c3c315f5df6371270e651e7d136f9ac91020..ad71197cf9cae1d2fabbdc3a41f78721ba19ec27 100644 (file)
@@ -31,6 +31,7 @@ import { splitByTokens, highlightSymbol, highlightIssueLocations } from '../help
 
 /*::
 type Props = {|
+  branch?: string,
   displayIssueLocationsCount?: boolean,
   displayIssueLocationsLink?: boolean,
   highlightedLocationMessage?: { index: number, text: string },
@@ -217,6 +218,7 @@ export default class LineCode extends React.PureComponent {
         {showIssues &&
         issues.length > 0 && (
           <LineIssuesList
+            branch={this.props.branch}
             displayIssueLocationsCount={this.props.displayIssueLocationsCount}
             displayIssueLocationsLink={this.props.displayIssueLocationsLink}
             issues={issues}
index d4c186a83e531693bfef81c62c2ab7e25ed6af20..573dbeba8097013517062628cb5ff60dd2b45a7d 100644 (file)
@@ -24,6 +24,7 @@ import Issue from '../../issue/Issue';
 
 /*::
 type Props = {
+  branch?: string,
   displayIssueLocationsCount?: boolean;
   displayIssueLocationsLink?: boolean;
   issues: Array<IssueType>,
@@ -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 (
       <div className="issue-list">
         {issues.map(issue => (
           <Issue
+            branch={branch}
             displayLocationsCount={this.props.displayIssueLocationsCount}
             displayLocationsLink={this.props.displayIssueLocationsLink}
             issue={issue}
index a67e04c3fafaec184f41d141d1ebc511037794c7..4788991131650cb8e2de7d5d9ea0018b9a285186 100644 (file)
@@ -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}
index fd6b8f2aa6dcebf7d473ae3197a1f746ce7a1496..5141e4d803228f51eea0f75ad605d04fe849110b 100644 (file)
@@ -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}
index bd4acefaa8448f4e3b96022a87888f35bf71f272..a445f5c152308bba7dae1035225aba3a06b36cd6 100644 (file)
@@ -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">
index bf2980f0c2dc7f00ddf984897c3bf13b8545f30a..f77de286ed3ca6114e5d2390b1df44f047b8dd32 100644 (file)
@@ -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();
 });
index 1302c5f2ac041d6d919a115758a9080cc5a356e1..18d585695f7600685dbf77c7301ae0b685d00ad3 100644 (file)
@@ -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",