Allow following yourself in you are not already

This commit is contained in:
Bojan Mojsilovic 2024-03-26 15:07:15 +01:00
parent 18f95a5e83
commit 5d08eeb097
4 changed files with 10 additions and 3 deletions

View File

@ -47,7 +47,7 @@ const PeopleList: Component<{ people: PrimalUser[], label: string, id?: string }
{truncateNpub(person?.npub)}
</div>
</div>
<Show when={account?.publicKey !== person.pubkey}>
<Show when={account?.publicKey !== person.pubkey || !account?.following.includes(person.pubkey)}>
<FollowButton person={person} />
</Show>
</A>

View File

@ -75,3 +75,7 @@
}
}
}
.placeholderDiv {
width: 72px;
}

View File

@ -59,7 +59,10 @@ const ProfileContact: Component<{
</div>
</div>
</Show>
<Show when={account?.publicKey !== props.profile?.pubkey}>
<Show
when={account?.publicKey !== props.profile?.pubkey || !account?.following.includes(props.profile?.pubkey || '')}
fallback={<div class={styles.placeholderDiv}></div>}
>
<FollowButton person={props.profile} postAction={props.postAction} />
</Show>
</div>

View File

@ -603,7 +603,7 @@ const Profile: Component = () => {
</ButtonSecondary>
</Show>
<Show when={account?.publicKey !== profile?.profileKey}>
<Show when={!isCurrentUser() || !account?.following.includes(profile?.profileKey || '')}>
<FollowButton person={profile?.userProfile} large={true} />
</Show>