2025-02-18 17:03:10 +00:00
< script module lang = "ts" >
import { goto } from "$app/navigation"
2025-09-03 22:29:57 +00:00
import { dissoc } from "@welshman/lib"
2025-06-16 23:56:59 +00:00
import { ROOM_META } from "@welshman/util"
import { load } from "@welshman/net"
2025-09-03 22:29:57 +00:00
import { pushToast } from "@app/util/toast"
2025-08-21 22:01:31 +00:00
import { makeSpacePath } from "@app/util/routes"
import { addSpaceMembership , broadcastUserData } from "@app/core/commands"
2025-09-03 22:29:57 +00:00
import { relaysMostlyRestricted } from "@app/core/state"
2025-02-18 17:03:10 +00:00
export const confirmSpaceJoin = async (url: string) => {
await addSpaceMembership(url)
2025-06-16 23:56:59 +00:00
const path = makeSpacePath(url)
if (window.location.pathname === path) {
load({
relays: [url],
filters: [{ kinds : [ ROOM_META ]} ],
})
}
broadcastUserData([url])
goto(path, { replaceState : true } )
2025-09-03 22:29:57 +00:00
relaysMostlyRestricted.update(dissoc(url))
pushToast({ message : "Welcome to the space!" } )
2025-02-18 17:03:10 +00:00
}
< / script >
< script lang = "ts" >
import Confirm from "@lib/components/Confirm.svelte"
type Props = {
url: string
}
const { url } : Props = $props()
const confirm = () => confirmSpaceJoin(url)
< / script >
< Confirm
{ confirm }
message="This space does not appear to limit who can post to it. This can result in a large amount of spam or other objectionable content. Continue?" />