mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-27 09:33:42 +01:00
Allow disabling the reply confirmation dialog
This commit is contained in:
parent
056a8a8ee4
commit
9a7201f2ee
4 changed files with 15 additions and 2 deletions
|
@ -22,6 +22,7 @@ import { muteStatus, unmuteStatus, deleteStatus } from 'flavours/glitch/actions/
|
||||||
import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
||||||
import { initReport } from 'flavours/glitch/actions/reports';
|
import { initReport } from 'flavours/glitch/actions/reports';
|
||||||
import { openModal } from 'flavours/glitch/actions/modal';
|
import { openModal } from 'flavours/glitch/actions/modal';
|
||||||
|
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
||||||
|
|
||||||
|
@ -71,10 +72,11 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onReply (status, router) {
|
onReply (status, router) {
|
||||||
dispatch((_, getState) => {
|
dispatch((_, getState) => {
|
||||||
let state = getState();
|
let state = getState();
|
||||||
if (state.getIn(['compose', 'text']).trim().length !== 0) {
|
if (state.getIn(['local_settings', 'confirm_before_clearing_draft']) && state.getIn(['compose', 'text']).trim().length !== 0) {
|
||||||
dispatch(openModal('CONFIRM', {
|
dispatch(openModal('CONFIRM', {
|
||||||
message: intl.formatMessage(messages.replyMessage),
|
message: intl.formatMessage(messages.replyMessage),
|
||||||
confirm: intl.formatMessage(messages.replyConfirm),
|
confirm: intl.formatMessage(messages.replyConfirm),
|
||||||
|
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)),
|
||||||
onConfirm: () => dispatch(replyCompose(status, router)),
|
onConfirm: () => dispatch(replyCompose(status, router)),
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -126,6 +126,14 @@ export default class LocalSettingsPage extends React.PureComponent {
|
||||||
>
|
>
|
||||||
<FormattedMessage id='settings.confirm_missing_media_description' defaultMessage='Show confirmation dialog before sending toots lacking media descriptions' />
|
<FormattedMessage id='settings.confirm_missing_media_description' defaultMessage='Show confirmation dialog before sending toots lacking media descriptions' />
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
|
<LocalSettingsPageItem
|
||||||
|
settings={settings}
|
||||||
|
item={['confirm_before_clearing_draft']}
|
||||||
|
id='mastodon-settings--confirm_before_clearing_draft'
|
||||||
|
onChange={onChange}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='settings.confirm_before_clearing_draft' defaultMessage='Show confirmation dialog before clearing draft' />
|
||||||
|
</LocalSettingsPageItem>
|
||||||
<LocalSettingsPageItem
|
<LocalSettingsPageItem
|
||||||
settings={settings}
|
settings={settings}
|
||||||
item={['side_arm']}
|
item={['side_arm']}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
mentionCompose,
|
mentionCompose,
|
||||||
directCompose,
|
directCompose,
|
||||||
} from 'flavours/glitch/actions/compose';
|
} from 'flavours/glitch/actions/compose';
|
||||||
|
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings';
|
||||||
import { blockAccount } from 'flavours/glitch/actions/accounts';
|
import { blockAccount } from 'flavours/glitch/actions/accounts';
|
||||||
import { muteStatus, unmuteStatus, deleteStatus } from 'flavours/glitch/actions/statuses';
|
import { muteStatus, unmuteStatus, deleteStatus } from 'flavours/glitch/actions/statuses';
|
||||||
import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
||||||
|
@ -98,7 +99,7 @@ const makeMapStateToProps = () => {
|
||||||
ancestorsIds,
|
ancestorsIds,
|
||||||
descendantsIds,
|
descendantsIds,
|
||||||
settings: state.get('local_settings'),
|
settings: state.get('local_settings'),
|
||||||
askReplyConfirmation: state.getIn(['compose', 'text']).trim().length !== 0,
|
askReplyConfirmation: state.getIn(['local_settings', 'confirm_before_clearing_draft']) && state.getIn(['compose', 'text']).trim().length !== 0,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ export default class Status extends ImmutablePureComponent {
|
||||||
dispatch(openModal('CONFIRM', {
|
dispatch(openModal('CONFIRM', {
|
||||||
message: intl.formatMessage(messages.replyMessage),
|
message: intl.formatMessage(messages.replyMessage),
|
||||||
confirm: intl.formatMessage(messages.replyConfirm),
|
confirm: intl.formatMessage(messages.replyConfirm),
|
||||||
|
onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)),
|
||||||
onConfirm: () => dispatch(replyCompose(status, this.context.router.history)),
|
onConfirm: () => dispatch(replyCompose(status, this.context.router.history)),
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,6 +14,7 @@ const initialState = ImmutableMap({
|
||||||
show_reply_count : false,
|
show_reply_count : false,
|
||||||
always_show_spoilers_field: false,
|
always_show_spoilers_field: false,
|
||||||
confirm_missing_media_description: false,
|
confirm_missing_media_description: false,
|
||||||
|
confirm_before_clearing_draft: true,
|
||||||
preselect_on_reply: true,
|
preselect_on_reply: true,
|
||||||
inline_preview_cards: true,
|
inline_preview_cards: true,
|
||||||
content_warnings : ImmutableMap({
|
content_warnings : ImmutableMap({
|
||||||
|
|
Loading…
Reference in a new issue