@@ 38,7 38,7 @@ import {
undoStatusTranslation,
} from 'flavours/glitch/actions/statuses';
import Status from 'flavours/glitch/components/status';
-import { favouriteModal, deleteModal } from 'flavours/glitch/initial_state';
+import { favouriteModal } from 'flavours/glitch/initial_state';
import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors';
import { showAlertForError } from '../actions/alerts';
@@ 184,18 184,20 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
},
onDelete (status, history, withRedraft = false) {
- if (state.getIn(['local_settings', 'confirm_delete']) ) {
- dispatch(deleteStatus(status.get('id'), history, withRedraft));
- } else {
- dispatch(openModal({
- modalType: 'CONFIRM',
- modalProps: {
- message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
- confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
- onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
- },
- }));
- }
+ dispatch((_, getState) => {
+ let state = getState(); // state used to be passed as a global variable through `deleteModal`, but everything else works like this (see non-described media and clearing drafts, for example)
+ if (!state.getIn(['local_settings', 'confirm_delete'])) {
+ dispatch(deleteStatus(status.get('id'), history, withRedraft));
+ } else {
+ dispatch(openModal({
+ modalType: 'CONFIRM',
+ modalProps: {
+ message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
+ confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
+ onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
+ },
+ }))};
+ });
},
onEdit (status, history) {
@@ 52,7 52,7 @@ import ScrollContainer from 'flavours/glitch/containers/scroll_container';
import StatusContainer from 'flavours/glitch/containers/status_container';
import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error';
import Column from 'flavours/glitch/features/ui/components/column';
-import { favouriteModal, deleteModal } from 'flavours/glitch/initial_state';
+import { favouriteModal } from 'flavours/glitch/initial_state';
import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors';
import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning';
@@ 385,7 385,7 @@ class Status extends ImmutablePureComponent {
handleDeleteClick = (status, history, withRedraft = false) => {
const { dispatch, intl } = this.props;
- if (!deleteModal) {
+ if (!settings.get('confirm_delete')) {
dispatch(deleteStatus(status.get('id'), history, withRedraft));
} else {
dispatch(openModal({