From dee43db7d612b97b65bc498be5ca11c17a8a121c Mon Sep 17 00:00:00 2001
From: n9lsjr <nilsjr@protonmail.com>
Date: Sun, 24 Nov 2024 00:46:20 +0100
Subject: [PATCH] Change to activeswarm

---
 src/routes/rooms/+page.svelte           | 6 +++---
 src/routes/rooms/components/Room.svelte | 4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/routes/rooms/+page.svelte b/src/routes/rooms/+page.svelte
index 593d3a93..344f0466 100644
--- a/src/routes/rooms/+page.svelte
+++ b/src/routes/rooms/+page.svelte
@@ -126,7 +126,7 @@ const sendRoomMsg = async (e) => {
     let time = Date.now()
     const hash = await window.api.createGroup()
     let myName = $user.username
-    let group = $rooms.thisRoom.key
+    let room = $swarm.activeSwarm?.key
     let in_swarm = true
     let in_channel = $swarm.activeChannel.name
     //Reaction switch
@@ -137,7 +137,7 @@ const sendRoomMsg = async (e) => {
     //Construct a new json object (myGroupMessage) to be able to print our message instant.
     let myRoomMessage = {
         message: msg,
-        grp: group,
+        grp: room,
         reply: replyto,
         address: myaddr,
         time: time,
@@ -147,7 +147,7 @@ const sendRoomMsg = async (e) => {
     }
     let sendMsg = {
         m: msg,
-        g: group,
+        g: room,
         r: replyto,
         k: myaddr,
         t: time,
diff --git a/src/routes/rooms/components/Room.svelte b/src/routes/rooms/components/Room.svelte
index 3bfd4992..082f819c 100644
--- a/src/routes/rooms/components/Room.svelte
+++ b/src/routes/rooms/components/Room.svelte
@@ -27,8 +27,6 @@
     const openRemove = () => {
         $rooms.removeRoom = !$rooms.removeRoom
     }
-    
-    $: thisSwarm = $swarm.active.find(a => a.key === r.key)
 
     $: in_voice = voice_channel.some(a => a.address === $user.myAddress)
     
@@ -48,7 +46,7 @@
         class="card"
         in:fade
         out:fade
-        class:active="{$rooms.thisRoom?.key === r.key}"
+        class:active="{$swarm.activeSwarm?.key === r.key}"
         on:click="{(e) => printRoom(r)}"
     >