From 5300404b468ed6077c3953bd09f5040aed2ae3ff Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 13 Nov 2025 13:44:52 -0800 Subject: [PATCH] Add option to ban users from profile detail dialog --- CONTEXT.md | 2 + src/app/components/ProfileDetail.svelte | 67 +++++++++++++++++++++++-- src/app/core/state.ts | 10 ++-- 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index 01420260..993ef2bc 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -30,3 +30,5 @@ The project follows a strict dependency hierarchy: ## Development Conventions When creating components related to a given space or room, parameterize them only with the entity's identifier (i.e., `url` and `h`). Only pass additional props if they can't be derived from the identifiers. For example, a room's `members` should be derived inside the child component, not passed in by the parent. + +Do not use null, only undefined. diff --git a/src/app/components/ProfileDetail.svelte b/src/app/components/ProfileDetail.svelte index e450a89e..80553303 100644 --- a/src/app/components/ProfileDetail.svelte +++ b/src/app/components/ProfileDetail.svelte @@ -1,19 +1,26 @@
- +
+ + {#if $userIsAdmin} +
+ + {#if showMenu} + + + + {/if} +
+ {/if} +
diff --git a/src/app/core/state.ts b/src/app/core/state.ts index bf5b18f0..0bceb584 100644 --- a/src/app/core/state.ts +++ b/src/app/core/state.ts @@ -824,12 +824,14 @@ export enum MembershipStatus { Granted, } -export const deriveUserIsSpaceAdmin = memoize((url: string) => { +export const deriveUserIsSpaceAdmin = memoize((url?: string) => { const store = writable(false) - manageRelay(url, {method: ManagementMethod.SupportedMethods, params: []}).then(res => - store.set(Boolean(res.result?.length)), - ) + if (url) { + manageRelay(url, {method: ManagementMethod.SupportedMethods, params: []}).then(res => + store.set(Boolean(res.result?.length)), + ) + } return store })