From 226c6291551c8f07b2f67914d2b28577b1df7244 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 14 Dec 2023 07:21:04 +0100 Subject: Cleanup --- MatrixRoomUtils.Web/Shared/MainLayout.razor | 2 +- .../RoomListComponents/RoomListCategory.razor | 23 ++++++++++++++++------ MatrixRoomUtils.Web/Shared/RoomListItem.razor | 6 ++++-- 3 files changed, 22 insertions(+), 9 deletions(-) (limited to 'MatrixRoomUtils.Web/Shared') diff --git a/MatrixRoomUtils.Web/Shared/MainLayout.razor b/MatrixRoomUtils.Web/Shared/MainLayout.razor index 691acbb..74db805 100644 --- a/MatrixRoomUtils.Web/Shared/MainLayout.razor +++ b/MatrixRoomUtils.Web/Shared/MainLayout.razor @@ -9,7 +9,7 @@
- Git + Git Matrix @if (showDownload) { Download diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor index cbe542a..55ffc1e 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor @@ -4,10 +4,10 @@ @using LibMatrix.Homeservers @using LibMatrix.Responses
- @roomType (@rooms.Count) - @foreach (var room in rooms) { + @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 *@ @@ -16,9 +16,12 @@ View state Edit state - @if (roomType == "Space") { + @if (room.CreationEventContent?.Type == "m.space") { } + else if (room.CreationEventContent?.Type == "support.feline.policy.lists.msc.v1" || RoomType == "org.matrix.mjolnir.policy") { + Manage policies + }
}
@@ -35,8 +38,8 @@ [CascadingParameter] public AuthenticatedHomeserverGeneric Homeserver { get; set; } = null!; - private string roomType => Category.Key; - private List rooms => Category.Value; + private string RoomType => Category.Key; + private List Rooms => Category.Value; private int RoomVersionDangerLevel(RoomInfo room) { var roomVersion = room.StateEvents.FirstOrDefault(x => x.Type == "m.room.create"); @@ -45,5 +48,13 @@ : 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", + _ => roomType + }; + } } diff --git a/MatrixRoomUtils.Web/Shared/RoomListItem.razor b/MatrixRoomUtils.Web/Shared/RoomListItem.razor index c5c3cfe..3aa28e6 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListItem.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListItem.razor @@ -91,13 +91,15 @@ else { LoadData = false; RoomInfo.StateEvents.Add(new() { Type = "m.room.create", - TypedContent = new RoomCreateEventContent() { RoomVersion = "0" } + TypedContent = new RoomCreateEventContent() { RoomVersion = "0" }, + RoomId = null, Sender = null, EventId = null //TODO: implement }); RoomInfo.StateEvents.Add(new() { Type = "m.room.name", TypedContent = new RoomNameEventContent() { Name = "M_FORBIDDEN: Are you a member of this room? " + RoomInfo.Room.RoomId - } + }, + RoomId = null, Sender = null, EventId = null //TODO: implement }); } } -- cgit 1.5.1