about summary refs log tree commit diff
path: root/MatrixUtils.Web/Pages/Moderation
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Web/Pages/Moderation')
-rw-r--r--MatrixUtils.Web/Pages/Moderation/DraupnirProtectedRoomsEditor.razor10
-rw-r--r--MatrixUtils.Web/Pages/Moderation/UserRoomHistory.razor4
2 files changed, 8 insertions, 6 deletions
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<DraupnirProtectedRoomsData>("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);
     }
diff --git a/MatrixUtils.Web/Pages/Moderation/UserRoomHistory.razor b/MatrixUtils.Web/Pages/Moderation/UserRoomHistory.razor
index 775361a..9218c8c 100644
--- a/MatrixUtils.Web/Pages/Moderation/UserRoomHistory.razor
+++ b/MatrixUtils.Web/Pages/Moderation/UserRoomHistory.razor
@@ -82,9 +82,7 @@ else {
                 if (state is null) continue;
                 if (!matchingStates.ContainsKey(state.Membership))
                     matchingStates.Add(state.Membership, new());
-                var roomInfo = new RoomInfo() {
-                    Room = room
-                };
+                var roomInfo = new RoomInfo(room);
                 matchingStates[state.Membership].Add(roomInfo);
                 roomInfo.StateEvents.Add(new() {
                     Type = RoomNameEventContent.EventId,