about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomManager')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor38
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor1
2 files changed, 14 insertions, 25 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
index 5cfda77..80d852a 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
@@ -1,9 +1,8 @@
 @page "/RoomManagerCreateRoom"
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.Responses
 @using System.Text.Json
-@using System.Text.Json.Serialization
 @using System.Reflection
+@using MatrixRoomUtils.Core.StateEventTypes
 @using MatrixRoomUtils.Web.Classes.RoomCreationTemplates
 @* ReSharper disable once RedundantUsingDirective - Must not remove this, Rider marks this as "unused" when it's not *@
 @using MatrixRoomUtils.Web.Shared.SimpleComponents
@@ -53,12 +52,12 @@
         <tr>
             <td style="padding-top: 16px;">History visibility:</td>
             <td style="padding-top: 16px;">
-                <InputSelect @bind-Value="@creationEvent.HistoryVisibility">
-                    <option value="invited">Invited</option>
-                    <option value="joined">Joined</option>
-                    <option value="shared">Shared</option>
-                    <option value="world_readable">World readable</option>
-                </InputSelect>
+                @* <InputSelect @bind-Value="@creationEvent.HistoryVisibility"> *@
+                @*     <option value="invited">Invited</option> *@
+                @*     <option value="joined">Joined</option> *@
+                @*     <option value="shared">Shared</option> *@
+                @*     <option value="world_readable">World readable</option> *@
+                @* </InputSelect> *@
             </td>
         </tr>
         <tr>
@@ -220,15 +219,15 @@
             OverwriteWrappedPropertiesFromEvent();
             creationEvent.PowerLevelContentOverride.Events = creationEvent.PowerLevelContentOverride.Events.OrderByDescending(x => x.Value).ThenBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
             creationEvent.PowerLevelContentOverride.Users = creationEvent.PowerLevelContentOverride.Users.OrderByDescending(x => x.Value).ThenBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
-            guestAccessEvent = creationEvent["m.room.guest_access"].As<GuestAccessContent>().Content;
+            guestAccessEvent = creationEvent["m.room.guest_access"].As<GuestAccessData>().Content;
 
             Console.WriteLine($"Creation event uncasted: {creationEvent["m.room.guest_access"].ToJson()}");
-            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
-            creationEvent["m.room.guest_access"].As<GuestAccessContent>().Content.IsGuestAccessEnabled = true;
+            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
+            creationEvent["m.room.guest_access"].As<GuestAccessData>().Content.IsGuestAccessEnabled = true;
             Console.WriteLine("-- Created new guest access content --");
             Console.WriteLine($"Creation event uncasted: {creationEvent["m.room.guest_access"].ToJson()}");
-            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
-            Console.WriteLine($"Creation event casted back: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
+            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
+            Console.WriteLine($"Creation event casted back: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
             StateHasChanged();
         }
     }
@@ -236,7 +235,7 @@
     private Dictionary<string, string> creationEventValidationErrors { get; set; } = new();
 
     private CreateRoomRequest creationEvent { get; set; }
-    GuestAccessContent guestAccessEvent { get; set; }
+    GuestAccessData guestAccessEvent { get; set; }
 
     private Dictionary<string, CreateRoomRequest> Presets { get; set; } = new();
 
@@ -275,7 +274,7 @@
         Console.WriteLine("Overwriting wrapped properties");
         Console.WriteLine($"Allow: {ServerACLAllowRules.Count}: {string.Join(", ", ServerACLAllowRules)}");
         Console.WriteLine($"Deny: {ServerACLDenyRules.Count}: {string.Join(", ", ServerACLDenyRules)}");
-        creationEvent.ServerACLs = new ServerACL {
+        creationEvent.ServerACLs = new ServerACLData {
             Allow = ServerACLAllowRules,
             Deny = ServerACLDenyRules,
             AllowIpLiterals = creationEvent.ServerACLs.AllowIpLiterals
@@ -336,14 +335,5 @@
         _ => key
         };
 
-    public class GuestAccessContent {
-        [JsonPropertyName("guest_access")]
-        public string GuestAccess { get; set; }
-
-        public bool IsGuestAccessEnabled {
-            get => GuestAccess == "can_join";
-            set => GuestAccess = value ? "can_join" : "forbidden";
-        }
-    }
     }
 
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
index ab650d1..a9c71c4 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
@@ -1,5 +1,4 @@
 @page "/RoomManager/Space/{RoomId}"
-@using MatrixRoomUtils.Core.Extensions
 @using System.Text.Json
 @using MatrixRoomUtils.Core.Responses
 <h3>Room manager - Viewing Space</h3>