ActionButton: put remote follow behind feature detection
This commit is contained in:
parent
3b0530073e
commit
3d898957e3
2 changed files with 35 additions and 12 deletions
|
@ -105,10 +105,9 @@ const ActionButton = ({ account, actionType, small }: iActionButton) => {
|
|||
);
|
||||
};
|
||||
|
||||
const empty = <></>;
|
||||
|
||||
if (!me) {
|
||||
// Remote follow
|
||||
/** Render a remote follow button, depending on features. */
|
||||
const renderRemoteFollow = (): JSX.Element | null => {
|
||||
// Remote follow through the API.
|
||||
if (features.remoteInteractionsAPI) {
|
||||
return (
|
||||
<Button
|
||||
|
@ -117,18 +116,36 @@ const ActionButton = ({ account, actionType, small }: iActionButton) => {
|
|||
text={intl.formatMessage(messages.follow)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// Pleroma's classic remote follow form.
|
||||
} else if (features.pleromaRemoteFollow) {
|
||||
return (
|
||||
<form method='POST' action='/main/ostatus'>
|
||||
<input type='hidden' name='nickname' value={account.get('acct')} />
|
||||
<input type='hidden' name='nickname' value={account.acct} />
|
||||
<input type='hidden' name='profile' value='' />
|
||||
<Button text={intl.formatMessage(messages.remote_follow)} type='submit' />
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
if (me !== account.get('id')) {
|
||||
return null;
|
||||
};
|
||||
|
||||
/** Render remote follow if federating, otherwise hide the button. */
|
||||
const renderLoggedOut = (): JSX.Element | null => {
|
||||
if (features.federating) {
|
||||
return renderRemoteFollow();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const empty = <></>;
|
||||
|
||||
if (!me) {
|
||||
return renderLoggedOut();
|
||||
}
|
||||
|
||||
if (me !== account.id) {
|
||||
const isFollowing = account.getIn(['relationship', 'following']);
|
||||
const blockedBy = account.getIn(['relationship', 'blocked_by']) as boolean;
|
||||
|
||||
|
|
|
@ -356,6 +356,12 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
*/
|
||||
paginatedContext: v.software === TRUTHSOCIAL,
|
||||
|
||||
/**
|
||||
* Displays a form to follow a user when logged out.
|
||||
* @see POST /main/ostatus
|
||||
*/
|
||||
pleromaRemoteFollow: v.software === PLEROMA,
|
||||
|
||||
/**
|
||||
* Can add polls to statuses.
|
||||
* @see POST /api/v1/statuses
|
||||
|
|
Loading…
Reference in a new issue