diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-25 03:07:05 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-25 03:07:05 +0200 |
commit | f866946fbbe962c712049327ade9dcbd43900295 (patch) | |
tree | 3400fcce20f68a6ef3eb130f4ef57733e346d0e9 /MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor | |
parent | Working sync (diff) | |
download | MatrixUtils-f866946fbbe962c712049327ade9dcbd43900295.tar.xz |
Working state, refactored Rory&::LibMatrix
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor')
-rw-r--r-- | MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor | 38 |
1 files changed, 14 insertions, 24 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"; - } - } } |