From ac2f2bffa26573347670e0391b036d8d2319803c Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Mon, 26 Aug 2019 11:51:25 +0200 Subject: SONAR-12414 Prevent opening an issue if click happens inside a changelog or comment dropdown --- .../js/components/issue/popups/ChangelogPopup.tsx | 69 +++---- .../js/components/issue/popups/CommentPopup.tsx | 57 +++--- .../__snapshots__/ChangelogPopup-test.tsx.snap | 218 +++++++++++---------- .../__snapshots__/CommentPopup-test.tsx.snap | 136 ++++++------- 4 files changed, 248 insertions(+), 232 deletions(-) diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx index 002fbe02777..aacb92f283f 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import ClickEventBoundary from 'sonar-ui-common/components/controls/ClickEventBoundary'; import { DropdownOverlay } from 'sonar-ui-common/components/controls/Dropdown'; import { PopupPlacement } from 'sonar-ui-common/components/ui/popups'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; @@ -63,44 +64,46 @@ export default class ChangelogPopup extends React.PureComponent { const { author } = issue; return ( -
- - - - - - - - {this.state.changelog.map((item, idx) => ( - + +
+
- - - {author ? `${translate('created_by')} ${author}` : translate('created')} -
+ + - ))} - -
- + -

- - {item.isUserActive - ? item.userName || item.user - : translateWithParameters('user.x_deleted', item.user)} -

- {item.diffs.map(diff => ( - - ))} + {author ? `${translate('created_by')} ${author}` : translate('created')}
-
+ + {this.state.changelog.map((item, idx) => ( + + + + + +

+ + {item.isUserActive + ? item.userName || item.user + : translateWithParameters('user.x_deleted', item.user)} +

+ {item.diffs.map(diff => ( + + ))} + + + ))} + + + +
); } diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx index aa5e411aa29..22f5f5f184c 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import { Button, ResetButtonLink } from 'sonar-ui-common/components/controls/buttons'; +import ClickEventBoundary from 'sonar-ui-common/components/controls/ClickEventBoundary'; import { DropdownOverlay } from 'sonar-ui-common/components/controls/Dropdown'; import { PopupPlacement } from 'sonar-ui-common/components/ui/popups'; import { translate } from 'sonar-ui-common/helpers/l10n'; @@ -73,35 +74,39 @@ export default class CommentPopup extends React.PureComponent { const { comment, autoTriggered } = this.props; return ( -
-
-