about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/account_timeline/containers/header_container.js
diff options
context:
space:
mode:
authorprplecake <me@prplecake.com>2022-10-18 17:12:55 -0500
committerGitHub <noreply@github.com>2022-10-19 00:12:55 +0200
commit1b83040bd45770ff831ff697418aaa2468a1516a (patch)
treefcea342cd9a520762e78d427ff594f1a2b16a128 /app/javascript/mastodon/features/account_timeline/containers/header_container.js
parent4adb267f9177f6036f8f27cd37544c54b97f3dd2 (diff)
Don't use "unfollow language" when cancelling follow requests (#19363)
* Don't use "unfollow language" when cancelling follow requests

- Adds two new i18n keys: `confirmations.cancel_follow_request.confirm`
  and `confirmations.cancel_follow_request.message`
- Update the header container to use new language

* "Withdraw follow request" instead of "cancel follow request"
Diffstat (limited to 'app/javascript/mastodon/features/account_timeline/containers/header_container.js')
-rw-r--r--app/javascript/mastodon/features/account_timeline/containers/header_container.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.js b/app/javascript/mastodon/features/account_timeline/containers/header_container.js
index 46fa573dd..62e59939c 100644
--- a/app/javascript/mastodon/features/account_timeline/containers/header_container.js
+++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.js
@@ -23,6 +23,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
 import { unfollowModal } from '../../../initial_state';
 
 const messages = defineMessages({
+  cancelFollowRequestConfirm: { id: 'confirmations.cancel_follow_request.confirm', defaultMessage: 'Withdraw request' },
   unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
   blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' },
 });
@@ -42,7 +43,7 @@ const makeMapStateToProps = () => {
 const mapDispatchToProps = (dispatch, { intl }) => ({
 
   onFollow (account) {
-    if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
+    if (account.getIn(['relationship', 'following'])) {
       if (unfollowModal) {
         dispatch(openModal('CONFIRM', {
           message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
@@ -52,6 +53,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
       } else {
         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(followAccount(account.get('id')));
     }