implement gating of button

This commit is contained in:
Samuel Newman
2025-06-27 16:22:13 +03:00
parent fde752379a
commit a15300ecdc
@@ -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}