]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9696 UI asks to comment issues after bulk change
authorStas Vilchik <stas.vilchik@sonarsource.com>
Tue, 10 Oct 2017 13:39:38 +0000 (15:39 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 11 Oct 2017 10:02:21 +0000 (12:02 +0200)
server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js

index f36ac5d3504565448b4663af87075d580b801c78..4227c2ab634bfe9bddfb7a35bea36c2bdb795956 100644 (file)
@@ -52,13 +52,6 @@ export default class IssueActionsBar extends React.PureComponent {
     commentPlaceholder: ''
   };
 
-  componentDidUpdate(prevProps /*: Props */) {
-    const { resolution } = this.props.issue;
-    if (!prevProps.issue.resolution && ['FALSE-POSITIVE', 'WONTFIX'].includes(resolution)) {
-      this.toggleComment(true, translate('issue.comment.tell_why'));
-    }
-  }
-
   setIssueProperty = (
     property /*: string */,
     popup /*: string */,
@@ -84,6 +77,13 @@ export default class IssueActionsBar extends React.PureComponent {
     this.props.togglePopup('comment', open);
   };
 
+  handleTransition = (issue /*: Issue */) => {
+    this.props.onChange(issue);
+    if (['FALSE-POSITIVE', 'WONTFIX'].includes(issue.resolution)) {
+      this.toggleComment(true, translate('issue.comment.tell_why'));
+    }
+  };
+
   render() {
     const { issue } = this.props;
     const canAssign = issue.actions.includes('assign');
@@ -121,7 +121,7 @@ export default class IssueActionsBar extends React.PureComponent {
                     isOpen={this.props.currentPopup === 'transition' && hasTransitions}
                     issue={issue}
                     hasTransitions={hasTransitions}
-                    onChange={this.props.onChange}
+                    onChange={this.handleTransition}
                     onFail={this.props.onFail}
                     togglePopup={this.props.togglePopup}
                   />