Fix profile publishing on email sign up

This commit is contained in:
Jon Staab
2026-01-09 09:55:10 -08:00
parent a7c944e8ef
commit 8ae7cf05cc
3 changed files with 17 additions and 13 deletions
+2 -12
View File
@@ -11,6 +11,7 @@
import ModalFooter from "@lib/components/ModalFooter.svelte" import ModalFooter from "@lib/components/ModalFooter.svelte"
import {clearModals} from "@app/util/modal" import {clearModals} from "@app/util/modal"
import {PROTECTED} from "@app/core/state" import {PROTECTED} from "@app/core/state"
import {initProfile} from "@app/core/commands"
type Props = { type Props = {
secret: string secret: string
@@ -22,19 +23,8 @@
const back = () => history.back() const back = () => history.back()
const next = () => { const next = () => {
const template = createProfile(profile)
// Start out protected by default
template.tags.push(PROTECTED)
const event = makeEvent(PROFILE, template)
// Log in first, then publish
loginWithNip01(secret) loginWithNip01(secret)
initProfile(profile)
// Don't publish anywhere yet, wait until they join a space
publishThunk({event, relays: []})
clearModals() clearModals()
} }
</script> </script>
+3 -1
View File
@@ -13,6 +13,7 @@
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte" import ModalHeader from "@lib/components/ModalHeader.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte" import ModalFooter from "@lib/components/ModalFooter.svelte"
import {initProfile} from "@app/core/commands"
import {clearModals} from "@app/util/modal" import {clearModals} from "@app/util/modal"
import {setChecked} from "@app/util/notifications" import {setChecked} from "@app/util/notifications"
import {pushToast} from "@app/util/toast" import {pushToast} from "@app/util/toast"
@@ -23,7 +24,7 @@
clientOptions: ClientOptions clientOptions: ClientOptions
} }
const {email, clientOptions}: Props = $props() const {email, profile, clientOptions}: Props = $props()
const back = () => history.back() const back = () => history.back()
@@ -36,6 +37,7 @@
try { try {
loginWithPomade(clientOptions.group.group_pk.slice(2), clientOptions) loginWithPomade(clientOptions.group.group_pk.slice(2), clientOptions)
pushToast({message: "Successfully logged in!"}) pushToast({message: "Successfully logged in!"})
initProfile(profile)
setChecked("*") setChecked("*")
clearModals() clearModals()
} finally { } finally {
+12
View File
@@ -754,6 +754,18 @@ export const uploadFile = async (file: File, options: UploadFileOptions = {}) =>
// Update Profile // Update Profile
export const initProfile = (profile: Profile) => {
const template = createProfile(profile)
// Start out protected by default
template.tags.push(PROTECTED)
const event = makeEvent(PROFILE, template)
// Don't publish anywhere yet, wait until they join a space
return publishThunk({event, relays: []})
}
export const updateProfile = async ({ export const updateProfile = async ({
profile, profile,
shouldBroadcast = !getTag(PROTECTED, profile.event?.tags || []), shouldBroadcast = !getTag(PROTECTED, profile.event?.tags || []),