about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-01-08 13:55:15 +0100
committerRory& <root@rory.gay>2024-01-08 13:56:32 +0100
commitede3857084bc7c6e65b7d36cbf913b09596e2787 (patch)
treeb94694c307fb831ea5e63fabde0dbb5f56f02941 /MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
parentSmall changes (diff)
downloadMatrixUtils-ede3857084bc7c6e65b7d36cbf913b09596e2787.tar.xz
Internal changes to policy list viewer (extensibility), fix duplicating change handler for room list page (performance), use /state in room list page before sync
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor')
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor13
1 files changed, 8 insertions, 5 deletions
diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
index 55ffc1e..4db25e1 100644
--- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
+++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
@@ -3,6 +3,7 @@
 @using LibMatrix.EventTypes.Spec.State
 @using LibMatrix.Homeservers
 @using LibMatrix.Responses
+@using MatrixRoomUtils.Abstractions
 <details>
     <summary>@RoomType (@Rooms.Count)</summary>
     @foreach (var room in Rooms) {
@@ -42,17 +43,19 @@
     private List<RoomInfo> Rooms => Category.Value;
 
     private int RoomVersionDangerLevel(RoomInfo room) {
-        var roomVersion = room.StateEvents.FirstOrDefault(x => x.Type == "m.room.create");
-        if (roomVersion is null) return 0;
-        return roomVersion.TypedContent is not RoomCreateEventContent roomVersionContent ? 0
+        var creationEvent = room.StateEvents.FirstOrDefault(x => x?.Type == "m.room.create");
+        if (creationEvent is null) return 0;
+        return creationEvent.TypedContent is not RoomCreateEventContent roomVersionContent ? 0
             : RoomConstants.DangerousRoomVersions.Contains(roomVersionContent.RoomVersion) ? 2
                 : roomVersionContent.RoomVersion != RoomConstants.RecommendedRoomVersion ? 1 : 0;
     }
     
     public static string GetRoomTypeName(string roomType) {
         return roomType switch {
-            "Room" => "Rooms",
-            "org.matrix.mjolnir.policy" => "Policies",
+            null => "Room",
+            "m.space" => "Space",
+            "org.matrix.mjolnir.policy" => "Policy room",
+            
             _ => roomType
         };
     }