[Glitch] Remove setting for unfollow confirmation modal, and make it unconditional

Port 37ca59815c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2691/head
Claire 2024-03-22 17:24:04 +01:00
parent 1d1c3a808a
commit afaad0755f
4 changed files with 46 additions and 69 deletions

View File

@ -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,7 +33,6 @@ 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: {
@ -43,9 +41,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
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')));
} }

View File

@ -19,7 +19,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';
@ -45,7 +44,6 @@ 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: {
@ -54,11 +52,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
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: {
@ -67,9 +61,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
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')));
} }

View File

@ -21,7 +21,7 @@ import { DisplayName } from 'flavours/glitch/components/display_name';
import { IconButton } from 'flavours/glitch/components/icon_button'; import { IconButton } from 'flavours/glitch/components/icon_button';
import { Permalink } from 'flavours/glitch/components/permalink'; import { Permalink } from 'flavours/glitch/components/permalink';
import { ShortNumber } from 'flavours/glitch/components/short_number'; import { ShortNumber } from 'flavours/glitch/components/short_number';
import { autoPlayGif, me, unfollowModal } from 'flavours/glitch/initial_state'; import { autoPlayGif, me } from 'flavours/glitch/initial_state';
import { makeGetAccount } from 'flavours/glitch/selectors'; import { makeGetAccount } from 'flavours/glitch/selectors';
const messages = defineMessages({ const messages = defineMessages({
@ -50,7 +50,6 @@ 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', modalType: 'CONFIRM',
@ -66,11 +65,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
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: {
@ -79,9 +74,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
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')));
} }

View File

@ -118,7 +118,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');