about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/account_timeline
diff options
context:
space:
mode:
authorprplecake <me@prplecake.com>2022-10-18 17:12:55 -0500
committerClaire <claire.github-309c@sitedethib.com>2022-10-28 19:24:02 +0200
commitb9195f8fb71ae7f4c48c896baff273c9518b6492 (patch)
tree98c4f3452319608c0d8154c8923dc1212a073297 /app/javascript/flavours/glitch/features/account_timeline
parent7cfb31928308cb6904d3b0e808365e98466890eb (diff)
[Glitch] Don't use "unfollow language" when cancelling follow requests
Port 1b83040bd45770ff831ff697418aaa2468a1516a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/account_timeline')
-rw-r--r--app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
index c1577e170..e6d8bb3bc 100644
--- a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
+++ b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js
@@ -24,6 +24,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
 import { unfollowModal } from 'flavours/glitch/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' },
 });
@@ -43,7 +44,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> }} />,
@@ -53,6 +54,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')));
     }