[Glitch] Fix confirmation when closing media edition modal with unsaved changes

Port aac7e9fd9d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Claire 2023-08-04 15:48:29 +02:00
parent 9d80be79a2
commit 9d885a93fc
2 changed files with 2 additions and 9 deletions

View File

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

View File

@ -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);
};