From e10fa389ce3c4d42deadfec8bf08c2fbb1a88d79 Mon Sep 17 00:00:00 2001 From: "Emma@Rory&" Date: Fri, 15 Sep 2023 09:55:36 +0200 Subject: Refactors --- MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor') 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

Homeserver Administration - Room Query

@@ -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 validOrderBy = new() { -- cgit 1.4.1