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