Fix current user check on profile page

This commit is contained in:
Bojan Mojsilovic 2023-07-27 09:54:50 +02:00
parent a08912a37c
commit 0435199d53

View File

@ -180,6 +180,13 @@ const Profile: Component = () => {
return styles.cacheFlag;
}
const isCurrentUser = () => {
if (!account || !profile || !account.isKeyLookupDone) {
return false;
}
return account?.publicKey === profile?.profileKey;
};
return (
<>
<PageTitle title={
@ -230,7 +237,7 @@ const Profile: Component = () => {
</Show>
<div class={styles.profileActions}>
<Show when={profile?.profileKey !== account?.publicKey}>
<Show when={!isCurrentUser()}>
<button
class={styles.smallPrimaryButton}
onClick={onNotImplemented}
@ -249,7 +256,7 @@ const Profile: Component = () => {
</Show>
<div class={styles.addToFeedButton}>
<Show when={profile?.profileKey !== account?.publicKey}>
<Show when={!isCurrentUser()}>
<Show
when={!hasFeedAtHome()}
fallback={
@ -281,7 +288,7 @@ const Profile: Component = () => {
<FollowButton person={profile?.userProfile} large={true} />
<Show when={account?.publicKey && profile?.userProfile?.pubkey === account?.publicKey}>
<Show when={isCurrentUser()}>
<button
class={styles.editProfileButton}
onClick={() => navigate('/settings/profile')}