about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-27 00:39:49 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-27 00:39:49 +0200
commita67276252c8bfcd6b6c5344e70debc6d67d917a9 (patch)
treeaf2806e9729f1013a5db6fbda80a7ad1cd7126fa /MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
parentidk (diff)
downloadMatrixUtils-a67276252c8bfcd6b6c5344e70debc6d67d917a9.tar.xz
Been a while since I last committed
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor40
1 files changed, 20 insertions, 20 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
index 638d728..3037dcc 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
@@ -12,7 +12,7 @@
 <br/>
 <InputSelect @bind-Value="shownStateKey">
     <option value="">-- State key --</option>
-    @foreach (var stateEvent in FilteredEvents.Where(x => x.state_key != "").Select(x => x.state_key).Distinct().OrderBy(x => x))
+    @foreach (var stateEvent in FilteredEvents.Where(x => x.StateKey != "").Select(x => x.StateKey).Distinct().OrderBy(x => x))
     {
         <option value="@stateEvent">@stateEvent</option>
         Console.WriteLine(stateEvent);
@@ -21,33 +21,33 @@
 <br/>
 <InputSelect @bind-Value="shownType">
     <option value="">-- Type --</option>
-    @foreach (var stateEvent in FilteredEvents.Where(x => x.state_key != shownStateKey).Select(x => x.type).Distinct().OrderBy(x => x))
+    @foreach (var stateEvent in FilteredEvents.Where(x => x.StateKey != shownStateKey).Select(x => x.Type).Distinct().OrderBy(x => x))
     {
         <option value="@stateEvent">@stateEvent</option>
     }
 </InputSelect>
 <br/>
 
-<textarea @bind="shownEventJson" style="width: 100%; height: fit-content;"></textarea>
+<textarea @bind="shownEventJson" style="width: 100%; height: fit-Content;"></textarea>
 
 <LogView></LogView>
 
 @code {
     //get room list
     // - sync withroom list filter
-    // type = support.feline.msc3784
+    // Type = support.feline.msc3784
     //support.feline.policy.lists.msc.v1
 
     [Parameter]
     public string? RoomId { get; set; }
 
-    public List<StateEvent> FilteredEvents { get; set; } = new();
-    public List<StateEvent> Events { get; set; } = new();
+    public List<StateEventResponse> FilteredEvents { get; set; } = new();
+    public List<StateEventResponse> Events { get; set; } = new();
     public string status = "";
 
     protected override async Task OnInitializedAsync()
     {
-        if (!RuntimeCache.WasLoaded) await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
+        await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
         await base.OnInitializedAsync();
         if (RuntimeCache.CurrentHomeServer != null)
         {
@@ -71,18 +71,18 @@
     // var response = await client.GetAsync($"http://localhost:5117/matrix-hq-state.json");
     //var _events = await response.Content.ReadFromJsonAsync<Queue<StateEventStruct>>();
         var _data = await response.Content.ReadAsStreamAsync();
-        var __events = JsonSerializer.DeserializeAsyncEnumerable<StateEvent>(_data);
+        var __events = JsonSerializer.DeserializeAsyncEnumerable<StateEventResponse>(_data);
         await foreach (var _ev in __events)
         {
-            var e = new StateEvent()
+            var e = new StateEventResponse()
             {
-                type = _ev.type,
-                state_key = _ev.state_key,
-                origin_server_ts = _ev.origin_server_ts,
-                content = _ev.content
+                Type = _ev.Type,
+                StateKey = _ev.StateKey,
+                OriginServerTs = _ev.OriginServerTs,
+                Content = _ev.Content
             };
             Events.Add(e);
-            if (string.IsNullOrEmpty(e.state_key))
+            if (string.IsNullOrEmpty(e.StateKey))
             {
                 FilteredEvents.Add(e);
             }
@@ -106,7 +106,7 @@
         await Task.Delay(1);
         var _FilteredEvents = Events;
         if (!ShowMembershipEvents)
-            _FilteredEvents = _FilteredEvents.Where(x => x.type != "m.room.member").ToList();
+            _FilteredEvents = _FilteredEvents.Where(x => x.Type != "m.room.member").ToList();
 
         status = "Done, rerendering!";
         StateHasChanged();
@@ -114,7 +114,7 @@
         FilteredEvents = _FilteredEvents;
         
         if(_shownType != null)
-            shownEventJson = _FilteredEvents.Where(x => x.type == _shownType).First().content.ToJson(indent: true, ignoreNull: true);
+            shownEventJson = _FilteredEvents.Where(x => x.Type == _shownType).First().Content.ToJson(indent: true, ignoreNull: true);
         
         StateHasChanged();
     }
@@ -126,10 +126,10 @@
         public long origin_server_ts { get; set; }
         public string state_key { get; set; }
         public string type { get; set; }
-    // public string sender { get; set; }
-    // public string event_id { get; set; }
-    // public string user_id { get; set; }
-    // public string replaces_state { get; set; }
+    // public string Sender { get; set; }
+    // public string EventId { get; set; }
+    // public string UserId { get; set; }
+    // public string ReplacesState { get; set; }
     }
 
     public bool ShowMembershipEvents