diff --git a/src/components/PeopleList/PeopleList.tsx b/src/components/PeopleList/PeopleList.tsx index 92c14d8..0ae95b4 100644 --- a/src/components/PeopleList/PeopleList.tsx +++ b/src/components/PeopleList/PeopleList.tsx @@ -1,5 +1,6 @@ import { A } from '@solidjs/router'; import { Component, For, Show } from 'solid-js'; +import { useAccountContext } from '../../contexts/AccountContext'; import { hookForDev } from '../../lib/devTools'; import { authorName, nip05Verification, truncateNpub } from '../../stores/profile'; import { PrimalUser } from '../../types/primal'; @@ -10,6 +11,8 @@ import styles from './PeopleList.module.scss'; const PeopleList: Component<{ people: PrimalUser[], label: string, id?: string }> = (props) => { + const account = useAccountContext(); + const people = () => props.people; return ( @@ -44,7 +47,9 @@ const PeopleList: Component<{ people: PrimalUser[], label: string, id?: string } {truncateNpub(person?.npub)} - + + + } diff --git a/src/components/ProfileContact/ProfileContact.tsx b/src/components/ProfileContact/ProfileContact.tsx index d82f789..37300d3 100644 --- a/src/components/ProfileContact/ProfileContact.tsx +++ b/src/components/ProfileContact/ProfileContact.tsx @@ -14,6 +14,7 @@ import Avatar from '../Avatar/Avatar'; import FollowButton from '../FollowButton/FollowButton'; import { A } from '@solidjs/router'; import { humanizeNumber } from '../../lib/stats'; +import { useAccountContext } from '../../contexts/AccountContext'; const ProfileContact: Component<{ @@ -24,6 +25,7 @@ const ProfileContact: Component<{ }> = (props) => { const intl = useIntl(); + const account = useAccountContext(); return (
@@ -57,7 +59,9 @@ const ProfileContact: Component<{
- + + + ); diff --git a/src/contexts/AccountContext.tsx b/src/contexts/AccountContext.tsx index 648a0f0..90f7d8f 100644 --- a/src/contexts/AccountContext.tsx +++ b/src/contexts/AccountContext.tsx @@ -757,7 +757,11 @@ export function AccountProvider(props: { children: JSXElement }) { } const removeFollow = (pubkey: string, cb?: (remove: boolean, pubkey: string) => void) => { - if (!store.publicKey || !store.following.includes(pubkey)) { + if ( + !store.publicKey || + !store.following.includes(pubkey) || + store.publicKey === pubkey + ) { return; } diff --git a/src/pages/CreateAccount.tsx b/src/pages/CreateAccount.tsx index a922de2..c919afa 100644 --- a/src/pages/CreateAccount.tsx +++ b/src/pages/CreateAccount.tsx @@ -210,14 +210,19 @@ const CreateAccount: Component = () => { const intl = useIntl(); toast?.sendSuccess(intl.formatMessage(tToast.updateProfileSuccess)); pubkey && getUserProfiles([pubkey], `user_profile_${APP_ID}`); - const tags = followed.map(pk => ['p', pk]); + let tags = followed.map(pk => ['p', pk]); const date = Math.floor((new Date()).getTime() / 1000); + if (pubkey) { + // Follow himself + tags.push(['p', pubkey]); + } + const sendResult = await sendContacts(tags, date, '', account.relays, relaySettings); if (sendResult.success && sendResult.note) { triggerImportEvents([sendResult.note], `import_contacts_${APP_ID}`, () => { - getProfileContactList(account?.publicKey, `user_contacts_${APP_ID}`); + getProfileContactList(pubkey, `user_contacts_${APP_ID}`); }); } @@ -225,7 +230,7 @@ const CreateAccount: Component = () => { const intl = useIntl(); if (relayResult.success && relayResult.note) { triggerImportEvents([relayResult.note], `import_relays_${APP_ID}`, () => { - getRelays(account?.publicKey, `user_relays_${APP_ID}`); + getRelays(pubkey, `user_relays_${APP_ID}`); }); } diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index b09f0bf..1013e26 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -603,7 +603,9 @@ const Profile: Component = () => { - + + +