2024-10-24 22:48:45 +00:00
|
|
|
<script lang="ts">
|
2025-02-19 01:15:41 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2024-10-24 22:48:45 +00:00
|
|
|
import Confirm from "@lib/components/Confirm.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {deletes, relays} from "@app/core"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {clearModals} from "@app/modal"
|
2024-10-24 22:48:45 +00:00
|
|
|
|
2025-02-19 01:15:41 +00:00
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
}
|
2024-10-24 22:48:45 +00:00
|
|
|
|
2025-02-19 01:15:41 +00:00
|
|
|
const {url, event}: Props = $props()
|
2025-02-04 04:57:47 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const shouldProtect = $relays.hasNip(url, 70)
|
2025-08-19 21:03:04 +00:00
|
|
|
|
2025-02-19 01:15:41 +00:00
|
|
|
const confirm = async () => {
|
2026-07-28 16:16:26 +00:00
|
|
|
const protect = await shouldProtect
|
|
|
|
|
const command = await $deletes.deleteEvent(event, writer => writer.setProtected(protect))
|
|
|
|
|
|
|
|
|
|
command.publishToRelays([url])
|
2024-10-24 22:48:45 +00:00
|
|
|
|
2024-10-29 20:20:59 +00:00
|
|
|
clearModals()
|
2024-10-24 22:48:45 +00:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<Confirm
|
|
|
|
|
{confirm}
|
|
|
|
|
title="Delete Message"
|
|
|
|
|
subtitle="Are you sure you want to delete this message?"
|
|
|
|
|
message="This will send a request to delete this message. Be aware that not all relays may honor this request." />
|