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 @@
<main>
<div class="top-row px-4">
<PortableDevTools></PortableDevTools>
- <a href="https://git.rory.gay/MatrixRoomUtils.git/" target="_blank">Git</a>
+ <a href="https://cgit.rory.gay/MatrixRoomUtils.git/" target="_blank">Git</a>
<a href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support" target="_blank">Matrix</a>
@if (showDownload) {
<a href="/MRU.tar.xz" target="_blank">Download</a>
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
<details>
- <summary>@roomType (@rooms.Count)</summary>
- @foreach (var room in rooms) {
+ <summary>@RoomType (@Rooms.Count)</summary>
+ @foreach (var room in Rooms) {
<div class="room-list-item">
- <RoomListItem RoomInfo="@room" ShowOwnProfile="@(roomType == "Room")"></RoomListItem>
+ <RoomListItem RoomInfo="@room" ShowOwnProfile="@(RoomType == "Room")"></RoomListItem>
@* @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"))) { *@
@* <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton Color="@(RoomVersionDangerLevel(room) == 2 ? "#ff0000" : "#ff8800")" href="@($"/Rooms/Create?Import={room.Room.RoomId}")">Upgrade room</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton> *@
@@ -16,9 +16,12 @@
<LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/View")">View state</LinkButton>
<LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/Edit")">Edit state</LinkButton>
- @if (roomType == "Space") {
+ @if (room.CreationEventContent?.Type == "m.space") {
<RoomListSpace Space="@room"></RoomListSpace>
}
+ else if (room.CreationEventContent?.Type == "support.feline.policy.lists.msc.v1" || RoomType == "org.matrix.mjolnir.policy") {
+ <LinkButton href="@($"/Rooms/{room.Room.RoomId}/Policies")">Manage policies</LinkButton>
+ }
</div>
}
</details>
@@ -35,8 +38,8 @@
[CascadingParameter]
public AuthenticatedHomeserverGeneric Homeserver { get; set; } = null!;
- private string roomType => Category.Key;
- private List<RoomInfo> rooms => Category.Value;
+ private string RoomType => Category.Key;
+ private List<RoomInfo> 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
});
}
}
|