about summary refs log tree commit diff
path: root/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-01-29 10:15:27 +0100
committerRory& <root@rory.gay>2024-01-29 10:15:27 +0100
commit3e6a73599bb58161c08d8675ea23ee6c82c6675c (patch)
treef3c0d1e797a77ed5993478d742751d386e004fb7 /MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
parentRoom member migrations (diff)
downloadMatrixUtils-3e6a73599bb58161c08d8675ea23ee6c82c6675c.tar.xz
Room list fixes, migration fix, update available handler
Diffstat (limited to 'MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor')
-rw-r--r--MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor17
1 files changed, 15 insertions, 2 deletions
diff --git a/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor b/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
index 895d642..9c481e3 100644
--- a/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
+++ b/MatrixUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
@@ -1,15 +1,23 @@
 @using System.Collections.ObjectModel
 @using MatrixUtils.Abstractions
-<MatrixUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{Space.Room.RoomId}/Space")">Manage space</MatrixUtils.Web.Shared.SimpleComponents.LinkButton>
+<LinkButton href="@($"/Rooms/{Space.Room.RoomId}/Space")">Manage space</LinkButton>
 
 <br/>
 <details @ontoggle="SpaceChildrenOpened">
     <summary>@Children.Count children</summary>
     @if (_shouldRenderChildren) {
         <p>Breadcrumb: @Breadcrumbs</p>
+        <p>Joined:</p>
         <div style="margin-left: 8px;">
             <RoomList Rooms="Children"></RoomList>
         </div>
+        <p>Unjoined:</p>
+        @foreach (var room in Unjoined) {
+            <p>@room.Room.RoomId</p>
+        }
+        @* <div style="margin-left: 8px;"> *@
+        @*     <RoomList Rooms="Children"></RoomList> *@
+        @* </div> *@
     }
 </details>
 
@@ -28,11 +36,14 @@
     }
 
     private ObservableCollection<RoomInfo> Children { get; set; } = new();
+    private Collection<RoomInfo> Unjoined { get; set; } = new();
 
     protected override async Task OnInitializedAsync() {
         if (Breadcrumbs == null) throw new ArgumentNullException(nameof(Breadcrumbs));
         await Task.Delay(Random.Shared.Next(1000, 10000));
         var rooms = Space.Room.AsSpace.GetChildrenAsync();
+        var hs = await RMUStorage.GetCurrentSessionOrNavigate();
+        var joinedRooms = await hs.GetJoinedRooms();
         await foreach (var room in rooms) {
             if (Breadcrumbs.Contains(room.RoomId)) continue;
             var roomInfo = KnownRooms.FirstOrDefault(x => x.Room.RoomId == room.RoomId);
@@ -42,7 +53,9 @@
                 };
                 KnownRooms.Add(roomInfo);
             }
-            Children.Add(roomInfo);
+            if(joinedRooms.Any(x=>x.RoomId == room.RoomId))
+                Children.Add(roomInfo);
+            else Unjoined.Add(roomInfo);
         }
         await base.OnInitializedAsync();
     }