implement gating of button
This commit is contained in:
@@ -142,8 +142,17 @@ let ProfileHeaderStandard = ({
|
|||||||
|
|
||||||
const {isActive: live} = useActorStatus(profile)
|
const {isActive: live} = useActorStatus(profile)
|
||||||
|
|
||||||
const subscriptionsDisallowed = useMemo(() => {
|
const subscriptionsAllowed = useMemo(() => {
|
||||||
return !!profile.labels?.find(label => label.val === '!no-subscriptions')
|
switch (profile.associated?.activitySubscription?.allowSubscriptions) {
|
||||||
|
case 'followers':
|
||||||
|
case undefined:
|
||||||
|
return !!profile.viewer?.following
|
||||||
|
case 'mutuals':
|
||||||
|
return !!profile.viewer?.following && !!profile.viewer.followedBy
|
||||||
|
case 'none':
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
}, [profile])
|
}, [profile])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -203,7 +212,7 @@ let ProfileHeaderStandard = ({
|
|||||||
)
|
)
|
||||||
) : !profile.viewer?.blockedBy ? (
|
) : !profile.viewer?.blockedBy ? (
|
||||||
<>
|
<>
|
||||||
{hasSession && !subscriptionsDisallowed && (
|
{hasSession && subscriptionsAllowed && (
|
||||||
<SubscribeProfileButton
|
<SubscribeProfileButton
|
||||||
profile={profile}
|
profile={profile}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
|
|||||||
Reference in New Issue
Block a user