Fix confirmation when closing media edition modal with unsaved changes (#26342)

local
Claire 10 months ago committed by GitHub
parent 93372fee1e
commit b59053ff8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/javascript/mastodon/features/ui/components/focal_point_modal.jsx
  2. 9
      app/javascript/mastodon/features/ui/components/modal_root.jsx

@ -434,4 +434,4 @@ class FocalPointModal extends ImmutablePureComponent {
export default connect(mapStateToProps, mapDispatchToProps, null, {
forwardRef: true,
})(injectIntl(FocalPointModal, { withRef: true }));
})(injectIntl(FocalPointModal, { forwardRef: true }));

@ -97,14 +97,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);
};

Loading…
Cancel
Save