Add landlubber link if user is admin

This commit is contained in:
Jon Staab
2025-11-04 16:55:26 -08:00
parent 2d89ca6c0e
commit 5c5c130700
2 changed files with 23 additions and 1 deletions
+12
View File
@@ -93,6 +93,7 @@ import {
verifyEvent,
readRoomMeta,
makeRoomMeta,
ManagementMethod,
} from "@welshman/util"
import type {
TrustedEvent,
@@ -126,6 +127,7 @@ import {
deriveRelay,
makeUserData,
makeUserLoader,
manageRelay,
} from "@welshman/app"
import type {Thunk} from "@welshman/app"
@@ -873,6 +875,16 @@ export const deriveUserCanCreateRoom = (url: string) =>
export const deriveUserIsRoomAdmin = (url: string, h: string) =>
derived([pubkey, deriveRoomAdmins(url, h)], ([$pubkey, $admins]) => $admins.includes($pubkey!))
export const deriveUserIsSpaceAdmin = (url: string) => {
const store = writable(false)
manageRelay(url, {method: ManagementMethod.SupportedMethods, params: []}).then(res =>
store.set(Boolean(res.result?.length)),
)
return store
}
// Other utils
export const encodeRelay = (url: string) =>