From d0d11db2209a8be65c27e15ca9d8a3b594f1a352 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 23 Feb 2024 13:57:06 +0100 Subject: Add eons of work because I forgot to push --- .../Pages/Moderation/DraupnirProtectedRoomsEditor.razor | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor') diff --git a/MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor b/MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor index 3cb9e40..f9cbfa2 100644 --- a/MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor +++ b/MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor @@ -59,7 +59,7 @@ if (hs is null) return; data = await hs.GetAccountDataAsync("org.matrix.mjolnir.protected_rooms"); StateHasChanged(); - foreach (var room in await hs.GetJoinedRooms()) { + var tasks = (await hs.GetJoinedRooms()).Select(async room => { var plTask = room.GetPowerLevelsAsync(); var roomNameTask = room.GetNameOrFallbackAsync(); var EditorRoomInfo = new EditorRoomInfo { @@ -71,7 +71,11 @@ Rooms.Add(EditorRoomInfo); StateHasChanged(); - } + return Task.CompletedTask; + }).ToList(); + await Task.WhenAll(tasks); + await Task.Delay(500); + StateHasChanged(); } private class DraupnirProtectedRoomsData { @@ -87,7 +91,7 @@ } private async Task Apply() { - Console.WriteLine(string.Join('\n', Rooms.Where(x=>x.IsProtected).Select(x=>x.Room.RoomId))); + Console.WriteLine(string.Join('\n', Rooms.Where(x => x.IsProtected).Select(x => x.Room.RoomId))); data.Rooms = Rooms.Where(x => x.IsProtected).Select(x => x.Room.RoomId).ToList(); await hs.SetAccountDataAsync("org.matrix.mjolnir.protected_rooms", data); } -- cgit 1.4.1