about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/HSAdmin
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-09-15 09:55:36 +0200
committerEmma@Rory& <root@rory.gay>2023-09-15 09:55:36 +0200
commite10fa389ce3c4d42deadfec8bf08c2fbb1a88d79 (patch)
tree1e2f8d8de07c6037ac4aa20be3b54ac43c2d7f2e /MatrixRoomUtils.Web/Pages/HSAdmin
parentCode cleanup (diff)
downloadMatrixUtils-e10fa389ce3c4d42deadfec8bf08c2fbb1a88d79.tar.xz
Refactors
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/HSAdmin')
-rw-r--r--MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor22
1 files changed, 13 insertions, 9 deletions
diff --git a/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor b/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
index 679f324..a4f9d97 100644
--- a/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
+++ b/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
@@ -1,8 +1,10 @@
 @page "/HSAdmin/RoomQuery"
-@using MatrixRoomUtils.Web.Shared.SimpleComponents
 @using LibMatrix.Responses.Admin
 @using LibMatrix.Filters
 @using LibMatrix.Extensions
+@using LibMatrix
+@using LibMatrix.Homeservers
+@using ArcaneLibs.Extensions
 
 <h3>Homeserver Administration - Room Query</h3>
 
@@ -168,15 +170,17 @@
     private async Task Search() {
         Results.Clear();
         var hs = await MRUStorage.GetCurrentSessionOrNavigate();
-        if (hs is null) return;
-        var searchRooms = hs.Admin.SearchRoomsAsync(orderBy: OrderBy!, dir: Ascending ? "f" : "b", searchTerm: SearchTerm, localFilter: Filter).GetAsyncEnumerator();
-        while (await searchRooms.MoveNextAsync()) {
-            var room = searchRooms.Current;
-            Console.WriteLine("Hit: " + room.ToJson(false));
-            Results.Add(room);
-            if (Results.Count % 10 == 0)
-                StateHasChanged();
+        if (hs is AuthenticatedHomeserverSynapse synapse) {
+            var searchRooms = synapse.Admin.SearchRoomsAsync(orderBy: OrderBy!, dir: Ascending ? "f" : "b", searchTerm: SearchTerm, localFilter: Filter).GetAsyncEnumerator();
+            while (await searchRooms.MoveNextAsync()) {
+                var room = searchRooms.Current;
+                Console.WriteLine("Hit: " + room.ToJson(false));
+                Results.Add(room);
+                if (Results.Count % 10 == 0)
+                    StateHasChanged();
+            }
         }
+
     }
 
     private readonly Dictionary<string, string> validOrderBy = new() {