Send leave request
This commit is contained in:
parent
4583c4e028
commit
fe72798592
3 changed files with 14 additions and 2 deletions
|
|
@ -43,6 +43,7 @@
|
||||||
deriveEventsForUrl,
|
deriveEventsForUrl,
|
||||||
deriveUserRooms,
|
deriveUserRooms,
|
||||||
deriveOtherRooms,
|
deriveOtherRooms,
|
||||||
|
userSpaceUrls,
|
||||||
hasNip29,
|
hasNip29,
|
||||||
alerts,
|
alerts,
|
||||||
deriveUserCanCreateRoom,
|
deriveUserCanCreateRoom,
|
||||||
|
|
@ -157,7 +158,7 @@
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
<li>
|
<li>
|
||||||
{#if $userRooms.includes(url)}
|
{#if $userSpaceUrls.includes(url)}
|
||||||
<Button onclick={leaveSpace} class="text-error">
|
<Button onclick={leaveSpace} class="text-error">
|
||||||
<Icon icon={Exit} />
|
<Icon icon={Exit} />
|
||||||
Leave Space
|
Leave Space
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,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 {removeSpaceMembership, removeTrustedRelay} from "@app/core/commands"
|
import {removeSpaceMembership, publishLeaveRequest, removeTrustedRelay} from "@app/core/commands"
|
||||||
|
|
||||||
const {url} = $props()
|
const {url} = $props()
|
||||||
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await removeSpaceMembership(url)
|
await removeSpaceMembership(url)
|
||||||
|
await publishLeaveRequest({url})
|
||||||
await removeTrustedRelay(url)
|
await removeTrustedRelay(url)
|
||||||
} finally {
|
} finally {
|
||||||
loading = false
|
loading = false
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import {
|
||||||
FOLLOWS,
|
FOLLOWS,
|
||||||
REACTION,
|
REACTION,
|
||||||
RELAY_JOIN,
|
RELAY_JOIN,
|
||||||
|
RELAY_LEAVE,
|
||||||
ROOMS,
|
ROOMS,
|
||||||
COMMENT,
|
COMMENT,
|
||||||
ALERT_EMAIL,
|
ALERT_EMAIL,
|
||||||
|
|
@ -627,6 +628,15 @@ export const makeJoinRequest = (params: JoinRequestParams) =>
|
||||||
export const publishJoinRequest = (params: JoinRequestParams) =>
|
export const publishJoinRequest = (params: JoinRequestParams) =>
|
||||||
publishThunk({event: makeJoinRequest(params), relays: [params.url]})
|
publishThunk({event: makeJoinRequest(params), relays: [params.url]})
|
||||||
|
|
||||||
|
// Leave request
|
||||||
|
|
||||||
|
export type LeaveRequestParams = {
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const publishLeaveRequest = (params: LeaveRequestParams) =>
|
||||||
|
publishThunk({event: makeEvent(RELAY_LEAVE), relays: [params.url]})
|
||||||
|
|
||||||
// Lightning
|
// Lightning
|
||||||
|
|
||||||
export const getWebLn = () => (window as any).webln
|
export const getWebLn = () => (window as any).webln
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue