mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 10:11:37 +01:00
Remove setting for unfollow confirmation modal, and make it unconditional (#29373)
This commit is contained in:
parent
119c7aa0df
commit
37ca59815c
8 changed files with 46 additions and 77 deletions
|
@ -13,7 +13,6 @@ import {
|
||||||
import { openModal } from '../actions/modal';
|
import { openModal } from '../actions/modal';
|
||||||
import { initMuteModal } from '../actions/mutes';
|
import { initMuteModal } from '../actions/mutes';
|
||||||
import Account from '../components/account';
|
import Account from '../components/account';
|
||||||
import { unfollowModal } from '../initial_state';
|
|
||||||
import { makeGetAccount } from '../selectors';
|
import { makeGetAccount } from '../selectors';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -34,18 +33,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
|
|
||||||
onFollow (account) {
|
onFollow (account) {
|
||||||
if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
|
if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
|
||||||
if (unfollowModal) {
|
dispatch(openModal({
|
||||||
dispatch(openModal({
|
modalType: 'CONFIRM',
|
||||||
modalType: 'CONFIRM',
|
modalProps: {
|
||||||
modalProps: {
|
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
||||||
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
confirm: intl.formatMessage(messages.unfollowConfirm),
|
||||||
confirm: intl.formatMessage(messages.unfollowConfirm),
|
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
||||||
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
},
|
||||||
},
|
}));
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dispatch(followAccount(account.get('id')));
|
dispatch(followAccount(account.get('id')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import { initDomainBlockModal, unblockDomain } from '../../../actions/domain_blo
|
||||||
import { openModal } from '../../../actions/modal';
|
import { openModal } from '../../../actions/modal';
|
||||||
import { initMuteModal } from '../../../actions/mutes';
|
import { initMuteModal } from '../../../actions/mutes';
|
||||||
import { initReport } from '../../../actions/reports';
|
import { initReport } from '../../../actions/reports';
|
||||||
import { unfollowModal } from '../../../initial_state';
|
|
||||||
import { makeGetAccount, getAccountHidden } from '../../../selectors';
|
import { makeGetAccount, getAccountHidden } from '../../../selectors';
|
||||||
import Header from '../components/header';
|
import Header from '../components/header';
|
||||||
|
|
||||||
|
@ -47,31 +46,23 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
|
|
||||||
onFollow (account) {
|
onFollow (account) {
|
||||||
if (account.getIn(['relationship', 'following'])) {
|
if (account.getIn(['relationship', 'following'])) {
|
||||||
if (unfollowModal) {
|
dispatch(openModal({
|
||||||
dispatch(openModal({
|
modalType: 'CONFIRM',
|
||||||
modalType: 'CONFIRM',
|
modalProps: {
|
||||||
modalProps: {
|
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
||||||
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
confirm: intl.formatMessage(messages.unfollowConfirm),
|
||||||
confirm: intl.formatMessage(messages.unfollowConfirm),
|
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
||||||
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
},
|
||||||
},
|
}));
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
|
||||||
}
|
|
||||||
} else if (account.getIn(['relationship', 'requested'])) {
|
} else if (account.getIn(['relationship', 'requested'])) {
|
||||||
if (unfollowModal) {
|
dispatch(openModal({
|
||||||
dispatch(openModal({
|
modalType: 'CONFIRM',
|
||||||
modalType: 'CONFIRM',
|
modalProps: {
|
||||||
modalProps: {
|
message: <FormattedMessage id='confirmations.cancel_follow_request.message' defaultMessage='Are you sure you want to withdraw your request to follow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
||||||
message: <FormattedMessage id='confirmations.cancel_follow_request.message' defaultMessage='Are you sure you want to withdraw your request to follow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
confirm: intl.formatMessage(messages.cancelFollowRequestConfirm),
|
||||||
confirm: intl.formatMessage(messages.cancelFollowRequestConfirm),
|
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
||||||
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
},
|
||||||
},
|
}));
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dispatch(followAccount(account.get('id')));
|
dispatch(followAccount(account.get('id')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { Avatar } from 'mastodon/components/avatar';
|
||||||
import { Button } from 'mastodon/components/button';
|
import { Button } from 'mastodon/components/button';
|
||||||
import { DisplayName } from 'mastodon/components/display_name';
|
import { DisplayName } from 'mastodon/components/display_name';
|
||||||
import { ShortNumber } from 'mastodon/components/short_number';
|
import { ShortNumber } from 'mastodon/components/short_number';
|
||||||
import { autoPlayGif, me, unfollowModal } from 'mastodon/initial_state';
|
import { autoPlayGif, me } from 'mastodon/initial_state';
|
||||||
import { makeGetAccount } from 'mastodon/selectors';
|
import { makeGetAccount } from 'mastodon/selectors';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -48,38 +48,30 @@ const makeMapStateToProps = () => {
|
||||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onFollow(account) {
|
onFollow(account) {
|
||||||
if (account.getIn(['relationship', 'following'])) {
|
if (account.getIn(['relationship', 'following'])) {
|
||||||
if (unfollowModal) {
|
dispatch(
|
||||||
dispatch(
|
openModal({
|
||||||
openModal({
|
|
||||||
modalType: 'CONFIRM',
|
|
||||||
modalProps: {
|
|
||||||
message: (
|
|
||||||
<FormattedMessage
|
|
||||||
id='confirmations.unfollow.message'
|
|
||||||
defaultMessage='Are you sure you want to unfollow {name}?'
|
|
||||||
values={{ name: <strong>@{account.get('acct')}</strong> }}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
confirm: intl.formatMessage(messages.unfollowConfirm),
|
|
||||||
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
|
||||||
} }),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
|
||||||
}
|
|
||||||
} else if (account.getIn(['relationship', 'requested'])) {
|
|
||||||
if (unfollowModal) {
|
|
||||||
dispatch(openModal({
|
|
||||||
modalType: 'CONFIRM',
|
modalType: 'CONFIRM',
|
||||||
modalProps: {
|
modalProps: {
|
||||||
message: <FormattedMessage id='confirmations.cancel_follow_request.message' defaultMessage='Are you sure you want to withdraw your request to follow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
message: (
|
||||||
confirm: intl.formatMessage(messages.cancelFollowRequestConfirm),
|
<FormattedMessage
|
||||||
|
id='confirmations.unfollow.message'
|
||||||
|
defaultMessage='Are you sure you want to unfollow {name}?'
|
||||||
|
values={{ name: <strong>@{account.get('acct')}</strong> }}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
confirm: intl.formatMessage(messages.unfollowConfirm),
|
||||||
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
||||||
},
|
} }),
|
||||||
}));
|
);
|
||||||
} else {
|
} else if (account.getIn(['relationship', 'requested'])) {
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
dispatch(openModal({
|
||||||
}
|
modalType: 'CONFIRM',
|
||||||
|
modalProps: {
|
||||||
|
message: <FormattedMessage id='confirmations.cancel_follow_request.message' defaultMessage='Are you sure you want to withdraw your request to follow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
||||||
|
confirm: intl.formatMessage(messages.cancelFollowRequestConfirm),
|
||||||
|
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
||||||
|
},
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
dispatch(followAccount(account.get('id')));
|
dispatch(followAccount(account.get('id')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
* @property {string} title
|
* @property {string} title
|
||||||
* @property {boolean} show_trends
|
* @property {boolean} show_trends
|
||||||
* @property {boolean} trends_as_landing_page
|
* @property {boolean} trends_as_landing_page
|
||||||
* @property {boolean} unfollow_modal
|
|
||||||
* @property {boolean} use_blurhash
|
* @property {boolean} use_blurhash
|
||||||
* @property {boolean=} use_pending_items
|
* @property {boolean=} use_pending_items
|
||||||
* @property {string} version
|
* @property {string} version
|
||||||
|
@ -99,7 +98,6 @@ export const source_url = getMeta('source_url');
|
||||||
export const timelinePreview = getMeta('timeline_preview');
|
export const timelinePreview = getMeta('timeline_preview');
|
||||||
export const title = getMeta('title');
|
export const title = getMeta('title');
|
||||||
export const trendsAsLanding = getMeta('trends_as_landing_page');
|
export const trendsAsLanding = getMeta('trends_as_landing_page');
|
||||||
export const unfollowModal = getMeta('unfollow_modal');
|
|
||||||
export const useBlurhash = getMeta('use_blurhash');
|
export const useBlurhash = getMeta('use_blurhash');
|
||||||
export const usePendingItems = getMeta('use_pending_items');
|
export const usePendingItems = getMeta('use_pending_items');
|
||||||
export const version = getMeta('version');
|
export const version = getMeta('version');
|
||||||
|
|
|
@ -27,10 +27,6 @@ module User::HasSettings
|
||||||
settings['default_sensitive']
|
settings['default_sensitive']
|
||||||
end
|
end
|
||||||
|
|
||||||
def setting_unfollow_modal
|
|
||||||
settings['web.unfollow_modal']
|
|
||||||
end
|
|
||||||
|
|
||||||
def setting_boost_modal
|
def setting_boost_modal
|
||||||
settings['web.reblog_modal']
|
settings['web.reblog_modal']
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,6 @@ class UserSettings
|
||||||
setting :disable_swiping, default: false
|
setting :disable_swiping, default: false
|
||||||
setting :delete_modal, default: true
|
setting :delete_modal, default: true
|
||||||
setting :reblog_modal, default: false
|
setting :reblog_modal, default: false
|
||||||
setting :unfollow_modal, default: true
|
|
||||||
setting :reduce_motion, default: false
|
setting :reduce_motion, default: false
|
||||||
setting :expand_content_warnings, default: false
|
setting :expand_content_warnings, default: false
|
||||||
setting :display_media, default: 'default', in: %w(default show_all hide_all)
|
setting :display_media, default: 'default', in: %w(default show_all hide_all)
|
||||||
|
|
|
@ -17,7 +17,6 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
if object.current_account
|
if object.current_account
|
||||||
store[:me] = object.current_account.id.to_s
|
store[:me] = object.current_account.id.to_s
|
||||||
store[:unfollow_modal] = object_account_user.setting_unfollow_modal
|
|
||||||
store[:boost_modal] = object_account_user.setting_boost_modal
|
store[:boost_modal] = object_account_user.setting_boost_modal
|
||||||
store[:delete_modal] = object_account_user.setting_delete_modal
|
store[:delete_modal] = object_account_user.setting_delete_modal
|
||||||
store[:auto_play_gif] = object_account_user.setting_auto_play_gif
|
store[:auto_play_gif] = object_account_user.setting_auto_play_gif
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
%h4= t 'appearance.confirmation_dialogs'
|
%h4= t 'appearance.confirmation_dialogs'
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= ff.input :'web.unfollow_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_unfollow_modal')
|
|
||||||
= ff.input :'web.reblog_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_boost_modal')
|
= ff.input :'web.reblog_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_boost_modal')
|
||||||
= ff.input :'web.delete_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_delete_modal')
|
= ff.input :'web.delete_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_delete_modal')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue