]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9566, SONAR-9570 Filter tags by organization when updating an issue tags
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 19 Jul 2017 15:24:02 +0000 (17:24 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 25 Jul 2017 07:20:30 +0000 (09:20 +0200)
server/sonar-web/src/main/js/components/issue/components/IssueTags.js
server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTags-test.js
server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTags-test.js.snap
server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.js
server/sonar-web/src/main/js/components/issue/popups/__tests__/SetIssueTagsPopup-test.js

index 8974ced8031a922ee6b4c9b9742d3db85df29df8..6e0365be9aad3e66bc7eb8ccf8698e784a301346 100644 (file)
@@ -67,6 +67,7 @@ export default class IssueTags extends React.PureComponent {
           popup={
             <SetIssueTagsPopup
               onFail={this.props.onFail}
+              organization={issue.projectOrganization}
               selectedTags={issue.tags}
               setTags={this.setTags}
             />
index ac17925d7bcfb57e537365459938b3171a6e4739..0262c1b317c8c1f2b02eccddaaa9ae9f72198d3b 100644 (file)
@@ -24,6 +24,7 @@ import { click } from '../../../../helpers/testUtils';
 
 const issue = {
   key: 'issuekey',
+  projectOrganization: 'foo',
   tags: ['mytag', 'test']
 };
 
index 1e1fc747a1f09c996728e49cb05722de4d691ad7..6cfa1ab8ea8ef468c0ca76b3054581c1011618d7 100644 (file)
@@ -24,6 +24,7 @@ exports[`should open the popup when the button is clicked 2`] = `
   popup={
     <SetIssueTagsPopup
       onFail={[Function]}
+      organization="foo"
       selectedTags={
         Array [
           "mytag",
@@ -59,6 +60,7 @@ exports[`should render with the action 1`] = `
   popup={
     <SetIssueTagsPopup
       onFail={[Function]}
+      organization="foo"
       selectedTags={
         Array [
           "mytag",
index 6a5a8150b2328bb57f6fb63ac1136a81a17dbe86..19951d07529a9ad1a3c9e3ee972189df80a40919 100644 (file)
@@ -26,6 +26,7 @@ import { searchIssueTags } from '../../../api/issues';
 type Props = {
   popupPosition?: {},
   onFail: Error => void,
+  organization: string,
   selectedTags: Array<string>,
   setTags: (Array<string>) => void
 };
@@ -59,7 +60,8 @@ export default class SetIssueTagsPopup extends React.PureComponent {
   onSearch = (query: string) => {
     searchIssueTags({
       q: query || '',
-      ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, 100)
+      ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, 100),
+      organization: this.props.organization
     }).then((tags: Array<string>) => {
       if (this.mounted) {
         this.setState({ searchResult: tags });
index c9d1c0a4e23c7d8374e52f90ca569e9dda22f5d8..2786b59ad9eb479bd6017cebc67c2ac5eb60b057 100644 (file)
@@ -23,7 +23,12 @@ import SetIssueTagsPopup from '../SetIssueTagsPopup';
 
 it('should render tags popup correctly', () => {
   const element = shallow(
-    <SetIssueTagsPopup onFail={jest.fn()} selectedTags="mytag" setTags={jest.fn()} />
+    <SetIssueTagsPopup
+      onFail={jest.fn()}
+      organization="foo"
+      selectedTags="mytag"
+      setTags={jest.fn()}
+    />
   );
   element.setState({ searchResult: ['mytag', 'test', 'second'] });
   expect(element).toMatchSnapshot();