mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 10:57:04 +00:00
Fix image modal, only show + room if the user is allowed
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
target: element,
|
target: element,
|
||||||
props: {
|
props: {
|
||||||
onClose: closeModals,
|
onClose: closeModals,
|
||||||
|
fullscreen: options.fullscreen,
|
||||||
children: createRawSnippet(() => ({
|
children: createRawSnippet(() => ({
|
||||||
render: () => "<div></div>",
|
render: () => "<div></div>",
|
||||||
setup: (target: Element) => {
|
setup: (target: Element) => {
|
||||||
|
|||||||
@@ -882,11 +882,19 @@ export const deriveUserRoomMembershipStatus = (url: string, h: string) =>
|
|||||||
|
|
||||||
export const deriveUserCanCreateRoom = (url: string) =>
|
export const deriveUserCanCreateRoom = (url: string) =>
|
||||||
derived(
|
derived(
|
||||||
[pubkey, deriveEventsForUrl(url, [{kinds: [ROOM_CREATE_PERMISSION]}])],
|
[
|
||||||
([$pubkey, $events]) => {
|
pubkey,
|
||||||
const event = first($events)
|
deriveEventsForUrl(url, [{kinds: [ROOM_CREATE_PERMISSION]}]),
|
||||||
|
deriveUserIsSpaceAdmin(url),
|
||||||
|
],
|
||||||
|
([$pubkey, $events, $isAdmin]) => {
|
||||||
|
for (const event of $events) {
|
||||||
|
if (getPubkeyTagValues(event.tags).includes($pubkey!)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return event ? getPubkeyTagValues(event.tags).includes($pubkey!) : true
|
return $isAdmin
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
transition:fade={{duration: 300}}
|
transition:fade={{duration: 300}}
|
||||||
onclick={onClose}>
|
onclick={onClose}>
|
||||||
</button>
|
</button>
|
||||||
<div class="scroll-container {extraClass}" transition:fly={{duration: 300}}>
|
<div class="scroll-container relative {extraClass}" transition:fly={{duration: 300}}>
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user