[Glitch] Fix being unable to withdraw follow request when confirmation modal is disabled (#19687)
Port cbb440bbc2
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
e42875d195
commit
6b498fae46
|
@ -61,6 +61,8 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
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')));
|
||||||
|
|
|
@ -25,6 +25,7 @@ const messages = defineMessages({
|
||||||
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
||||||
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
||||||
cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' },
|
cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' },
|
||||||
|
cancelFollowRequestConfirm: { id: 'confirmations.cancel_follow_request.confirm', defaultMessage: 'Withdraw request' },
|
||||||
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
|
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
|
||||||
unblock: { id: 'account.unblock_short', defaultMessage: 'Unblock' },
|
unblock: { id: 'account.unblock_short', defaultMessage: 'Unblock' },
|
||||||
unmute: { id: 'account.unmute_short', defaultMessage: 'Unmute' },
|
unmute: { id: 'account.unmute_short', defaultMessage: 'Unmute' },
|
||||||
|
@ -45,10 +46,7 @@ const makeMapStateToProps = () => {
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onFollow(account) {
|
onFollow(account) {
|
||||||
if (
|
if (account.getIn(['relationship', 'following'])) {
|
||||||
account.getIn(['relationship', 'following']) ||
|
|
||||||
account.getIn(['relationship', 'requested'])
|
|
||||||
) {
|
|
||||||
if (unfollowModal) {
|
if (unfollowModal) {
|
||||||
dispatch(
|
dispatch(
|
||||||
openModal('CONFIRM', {
|
openModal('CONFIRM', {
|
||||||
|
@ -66,6 +64,16 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
} else {
|
} else {
|
||||||
dispatch(unfollowAccount(account.get('id')));
|
dispatch(unfollowAccount(account.get('id')));
|
||||||
}
|
}
|
||||||
|
} else if (account.getIn(['relationship', 'requested'])) {
|
||||||
|
if (unfollowModal) {
|
||||||
|
dispatch(openModal('CONFIRM', {
|
||||||
|
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 {
|
||||||
|
dispatch(unfollowAccount(account.get('id')));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dispatch(followAccount(account.get('id')));
|
dispatch(followAccount(account.get('id')));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue