From 2f50b77ae8de7ac217ae8ea0b8c63ed67861db9f Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 4 Aug 2023 15:48:29 +0200 Subject: [PATCH] [Glitch] Fix confirmation when closing media edition modal with unsaved changes Port b59053ff8c5e15dcbc5b6a46463bc89495c0b0e1 to glitch-soc Signed-off-by: Claire --- .../glitch/features/ui/components/focal_point_modal.jsx | 2 +- .../glitch/features/ui/components/modal_root.jsx | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx index ed3bed47e..eeef42277 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx @@ -423,4 +423,4 @@ class FocalPointModal extends ImmutablePureComponent { export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true, -})(injectIntl(FocalPointModal, { withRef: true })); +})(injectIntl(FocalPointModal, { forwardRef: true })); diff --git a/app/javascript/flavours/glitch/features/ui/components/modal_root.jsx b/app/javascript/flavours/glitch/features/ui/components/modal_root.jsx index 1e5bf40db..7e94141fb 100644 --- a/app/javascript/flavours/glitch/features/ui/components/modal_root.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/modal_root.jsx @@ -105,14 +105,7 @@ export default class ModalRoot extends PureComponent { handleClose = (ignoreFocus = false) => { const { onClose } = this.props; - let message = null; - try { - message = this._modal?.getWrappedInstance?.().getCloseConfirmationMessage?.(); - } catch (_) { - // injectIntl defines `getWrappedInstance` but errors out if `withRef` - // isn't set. - // This would be much smoother with react-intl 3+ and `forwardRef`. - } + const message = this._modal?.getCloseConfirmationMessage?.(); onClose(message, ignoreFocus); };