Fix profile publishing on email sign up
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 || []),
|
||||||
|
|||||||
Reference in New Issue
Block a user