diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index c2b827d9e1bb58..8df605686d5b28 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -25,6 +25,8 @@ import FollowRequestNoteContainer from '../containers/follow_request_note_contai const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' }, + followBack: { id: 'account.follow_back', defaultMessage: 'Follow back' }, + mutual: { id: 'account.mutual', defaultMessage: 'Mutual' }, cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, @@ -71,6 +73,20 @@ const titleFromAccount = account => { return `${prefix} (@${acct})`; }; +const messageForFollowButton = relationship => { + if(!relationship) return messages.follow; + + if (relationship.get('following') && relationship.get('followed_by')) { + return messages.mutual; + } else if (!relationship.get('following') && relationship.get('followed_by')) { + return messages.followBack; + } else if (relationship.get('following')) { + return messages.unfollow; + } else { + return messages.follow; + } +}; + const dateFormatOptions = { month: 'short', day: 'numeric', @@ -175,9 +191,7 @@ class Header extends ImmutablePureComponent { let lockedIcon = ''; let menu = []; - if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { - info.push(); - } else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { + if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { info.push(); } @@ -197,7 +211,7 @@ class Header extends ImmutablePureComponent { } else if (account.getIn(['relationship', 'requested'])) { actionBtn =