Use userRoomsByUrl

This commit is contained in:
Jon Staab
2024-12-16 17:07:52 -08:00
parent d0565e7c62
commit 166bd81310
10 changed files with 22 additions and 31 deletions
+3 -3
View File
@@ -185,11 +185,11 @@
}
// Listen for space data, populate space-based notifications
let spacesSub: any
let unsubSpaces: any
userMembership.subscribe($membership => {
spacesSub?.close()
spacesSub = listenForNotifications()
unsubSpaces?.()
unsubSpaces = listenForNotifications()
})
// Listen for chats, populate chat-based notifications
+2 -2
View File
@@ -15,10 +15,10 @@
import SpaceCheck from "@app/components/SpaceCheck.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte"
import {
userMembership,
memberships,
membershipByPubkey,
getMembershipUrls,
userRoomsByUrl,
getDefaultPubkeys,
} from "@app/state"
import {discoverRelays} from "@app/commands"
@@ -98,7 +98,7 @@
{/if}
</div>
</div>
{#if getMembershipUrls($userMembership).includes(relay.url)}
{#if $userRoomsByUrl.has(relay.url)}
<div
class="tooltip absolute -right-1 -top-1 h-5 w-5 rounded-full bg-primary"
data-tip="You are already a member of this space.">
+2 -3
View File
@@ -22,8 +22,7 @@
channelsById,
deriveUserRooms,
deriveOtherRooms,
userMembership,
getMembershipUrls,
userRoomsByUrl,
} from "@app/state"
import {makeChatPath, makeRoomPath, makeSpacePath} from "@app/routes"
import {notifications} from "@app/notifications"
@@ -51,7 +50,7 @@
</div>
<strong slot="title">Home</strong>
<div slot="action" class="row-2">
{#if !getMembershipUrls($userMembership).includes(url)}
{#if !$userRoomsByUrl.has(url)}
<Button class="btn btn-primary btn-sm" on:click={joinSpace}>
<Icon icon="login-2" />
Join Space
@@ -24,13 +24,12 @@
import ChannelCompose from "@app/components/ChannelCompose.svelte"
import {
userSettingValues,
userMembership,
decodeRelay,
deriveEventsForUrl,
GENERAL,
tagRoom,
LEGACY_MESSAGE,
getMembershipRoomsByUrl,
userRoomsByUrl,
displayChannel,
} from "@app/state"
import {setChecked} from "@app/notifications"
@@ -160,7 +159,7 @@
</strong>
<div slot="action" class="row-2">
{#if room !== GENERAL}
{#if getMembershipRoomsByUrl(url, $userMembership).includes(room)}
{#if $userRoomsByUrl.get(url)?.has(room)}
<Button class="btn btn-neutral btn-sm" on:click={leaveRoom}>
<Icon icon="arrows-a-logout-2" />
Leave Room