From 056a8a8ee48e79993f42a910b86d70523aa9f0ae Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 27 Nov 2018 17:31:50 +0100 Subject: Allow disabling media confirmation from the confirmation dialog itself --- .../features/ui/components/confirmation_modal.js | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'app/javascript/flavours/glitch/features/ui') diff --git a/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js b/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js index d4d1e587e..07281f818 100644 --- a/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js @@ -11,6 +11,7 @@ export default class ConfirmationModal extends React.PureComponent { confirm: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired, + onDoNotAsk: PropTypes.func, intl: PropTypes.object.isRequired, }; @@ -21,6 +22,9 @@ export default class ConfirmationModal extends React.PureComponent { handleClick = () => { this.props.onClose(); this.props.onConfirm(); + if (this.props.onDoNotAsk && this.doNotAskCheckbox.checked) { + this.props.onDoNotAsk(); + } } handleCancel = () => { @@ -31,8 +35,12 @@ export default class ConfirmationModal extends React.PureComponent { this.button = c; } + setDoNotAskRef = (c) => { + this.doNotAskCheckbox = c; + } + render () { - const { message, confirm } = this.props; + const { message, confirm, onDoNotAsk } = this.props; return (
@@ -40,11 +48,21 @@ export default class ConfirmationModal extends React.PureComponent { {message}
-
- - +
); -- cgit