Move create room permission check to menu space

This commit is contained in:
Matthew Remmel
2025-10-14 09:34:01 -04:00
committed by Jon Staab
parent a39a87ba6d
commit 69e3ee0aff
3 changed files with 23 additions and 19 deletions
+11 -7
View File
@@ -53,6 +53,7 @@ import {
ROOM_JOIN,
ROOM_ADD_USER,
ROOM_REMOVE_USER,
ROOM_CREATE_PERMISSION,
ALERT_EMAIL,
ALERT_WEB,
ALERT_IOS,
@@ -762,15 +763,18 @@ export const deriveUserMembershipStatus = (url: string, room: string) =>
)
export const deriveUserCanCreateRoom = (url: string) =>
derived([pubkey, deriveEventsForUrl(url, [{kinds: [39004]}])], ([$pubkey, $events]) => {
const latest = last($events)
derived(
[pubkey, deriveEventsForUrl(url, [{kinds: [ROOM_CREATE_PERMISSION]}])],
([$pubkey, $events]) => {
const latest = last($events)
if (!latest) {
return true
}
if (!latest) {
return true
}
return getTagValues("p", latest.tags).includes($pubkey!)
})
return getTagValues("p", latest.tags).includes($pubkey!)
},
)
// Other utils