diff --git a/src/actions/nostr.ts b/src/actions/nostr.ts index 7f60eff5b..ea1da3c29 100644 --- a/src/actions/nostr.ts +++ b/src/actions/nostr.ts @@ -32,6 +32,8 @@ function logInNostr(pubkey: string, onboard = false) { dispatch(startOnboarding()); } + dispatch(setNostrPubkey(undefined)); + const { access_token } = dispatch(authLoggedIn(token)); return await dispatch(verifyCredentials(access_token as string)); }; @@ -48,7 +50,7 @@ function nostrExtensionLogIn() { }; } -function setNostrPubkey(pubkey: string) { +function setNostrPubkey(pubkey: string | undefined) { return { type: NOSTR_PUBKEY_SET, pubkey, diff --git a/src/components/status-action-bar.tsx b/src/components/status-action-bar.tsx index f4005a7b2..ad6376cac 100644 --- a/src/components/status-action-bar.tsx +++ b/src/components/status-action-bar.tsx @@ -430,7 +430,7 @@ const StatusActionBar: React.FC = ({ } } - if (features.federating && !account.local) { + if (features.federating && (status.ditto?.get('external_url') || !account.local)) { const externalNostrUrl: string | undefined = status.ditto?.get('external_url'); const { hostname: domain } = new URL(externalNostrUrl || status.uri); diff --git a/src/contexts/nostr-context.tsx b/src/contexts/nostr-context.tsx index a652e82c1..92bc9095b 100644 --- a/src/contexts/nostr-context.tsx +++ b/src/contexts/nostr-context.tsx @@ -28,7 +28,7 @@ export const NostrProvider: React.FC = ({ children }) => { const { account } = useOwnAccount(); const url = instance.nostr?.relay; - const accountPubkey = useAppSelector((state) => account?.nostr.pubkey ?? state.meta.pubkey); + const accountPubkey = useAppSelector((state) => state.meta.pubkey ?? account?.nostr.pubkey); const signer = useMemo( () => (accountPubkey ? NKeys.get(accountPubkey) : undefined) ?? window.nostr,