diff --git a/src/app/components/EventMenu.svelte b/src/app/components/EventMenu.svelte index 174a28b5..0527c34e 100644 --- a/src/app/components/EventMenu.svelte +++ b/src/app/components/EventMenu.svelte @@ -3,7 +3,7 @@ import type {Snippet} from "svelte" import {goto} from "$app/navigation" import type {TrustedEvent} from "@welshman/util" - import {COMMENT, ManagementMethod} from "@welshman/util" + import {COMMENT, ManagementMethod, getTagValue} from "@welshman/util" import {pubkey, repository, relaysByUrl, manageRelay} from "@welshman/app" import ShareCircle from "@assets/icons/share-circle.svg?dataurl" import Code2 from "@assets/icons/code-2.svg?dataurl" @@ -18,6 +18,7 @@ import EventShare from "@app/components/EventShare.svelte" import EventDeleteConfirm from "@app/components/EventDeleteConfirm.svelte" import {hasNip29, deriveUserIsSpaceAdmin} from "@app/core/state" + import {hasPermission} from "@app/core/roles" import {pushModal} from "@app/util/modal" import {pushToast} from "@app/util/toast" import {makeSpaceChatPath} from "@app/util/routes" @@ -33,7 +34,8 @@ const {url, noun, event, onClick, customActions}: Props = $props() const isRoot = event.kind !== COMMENT - const userIsAdmin = deriveUserIsSpaceAdmin(url) + const h = getTagValue("h", event.tags) + const canDelete = h ? hasPermission(url, h, 9005) : deriveUserIsSpaceAdmin(url) const report = () => pushModal(Report, {url, event}) @@ -107,7 +109,7 @@ Report Content - {#if $userIsAdmin} + {#if $canDelete}