@using MatrixRoomUtils.Web.Classes.Constants @using LibMatrix @using LibMatrix.EventTypes.Spec.State @using LibMatrix.Homeservers @using LibMatrix.Responses @using MatrixRoomUtils.Abstractions
@RoomType (@Rooms.Count) @foreach (var room in Rooms) {
@* @if (RoomVersionDangerLevel(room) != 0 && *@ @* (room.StateEvents.FirstOrDefault(x=>x.Type == "m.room.power_levels")?.TypedContent is RoomPowerLevelEventContent powerLevels && powerLevels.UserHasPermission(Homeserver.UserId, "m.room.tombstone"))) { *@ @* Upgrade room *@ @* } *@ View timeline View state Edit state @if (room.CreationEventContent?.Type == "m.space") { } else if (room.CreationEventContent?.Type == "support.feline.policy.lists.msc.v1" || RoomType == "org.matrix.mjolnir.policy") { Manage policies }
}

@code { [Parameter] public KeyValuePair> Category { get; set; } [Parameter] public UserProfileResponse? GlobalProfile { get; set; } [CascadingParameter] public AuthenticatedHomeserverGeneric Homeserver { get; set; } = null!; private string RoomType => Category.Key; private List Rooms => Category.Value; private int RoomVersionDangerLevel(RoomInfo room) { 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 { null => "Room", "m.space" => "Space", "org.matrix.mjolnir.policy" => "Policy room", _ => roomType }; } }