From 166bd8131045790923b27c778555ed75c3f03d97 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 16 Dec 2024 17:07:52 -0800 Subject: [PATCH] Use userRoomsByUrl --- src/app/commands.ts | 6 +++--- src/app/components/MenuSpace.svelte | 5 ++--- src/app/components/MenuSpaces.svelte | 6 +++--- src/app/components/PrimaryNav.svelte | 10 ++-------- src/app/routes.ts | 4 ++-- src/app/state.ts | 2 +- src/routes/+layout.svelte | 6 +++--- src/routes/discover/+page.svelte | 4 ++-- src/routes/spaces/[relay]/+page.svelte | 5 ++--- src/routes/spaces/[relay]/[room]/+page.svelte | 5 ++--- 10 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/app/commands.ts b/src/app/commands.ts index ed9f772..2d63b63 100644 --- a/src/app/commands.ts +++ b/src/app/commands.ts @@ -65,7 +65,7 @@ import { loadMembership, loadSettings, getDefaultPubkeys, - getMembershipUrls, + userRoomsByUrl, } from "@app/state" // Utils @@ -301,7 +301,7 @@ export const setRelayPolicy = (url: string, read: boolean, write: boolean) => { url, ...INDEXER_RELAYS, ...ctx.app.router.FromUser().getUrls(), - ...getMembershipUrls(userMembership.get()), + ...userRoomsByUrl.get().keys(), ], }) } @@ -322,7 +322,7 @@ export const setInboxRelayPolicy = (url: string, enabled: boolean) => { relays: [ ...INDEXER_RELAYS, ...ctx.app.router.FromUser().getUrls(), - ...getMembershipUrls(userMembership.get()), + ...userRoomsByUrl.get().keys(), ], }) } diff --git a/src/app/components/MenuSpace.svelte b/src/app/components/MenuSpace.svelte index 4cc26d4..f8503d3 100644 --- a/src/app/components/MenuSpace.svelte +++ b/src/app/components/MenuSpace.svelte @@ -15,9 +15,8 @@ import RoomCreate from "@app/components/RoomCreate.svelte" import MenuSpaceRoomItem from "@app/components/MenuSpaceRoomItem.svelte" import { - getMembershipUrls, + userRoomsByUrl, hasMembershipUrl, - userMembership, memberships, deriveUserRooms, deriveOtherRooms, @@ -93,7 +92,7 @@
  • - {#if getMembershipUrls($userMembership).includes(url)} + {#if $userRoomsByUrl.has(url)}