@page "/Rooms/{RoomId}/State/View" @using LibMatrix.Extensions @using LibMatrix.Responses @using ArcaneLibs.Extensions @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager

Room state viewer - Viewing @RoomId


@status

Show member events @foreach (var stateEvent in FilteredEvents.Where(x => x.StateKey == "").OrderBy(x => x.OriginServerTs)) { }
Type Content
@stateEvent.Type
@stateEvent.RawContent.ToJson()
@foreach (var group in FilteredEvents.GroupBy(x => x.StateKey).OrderBy(x => x.Key).Where(x => x.Key != "")) {
@group.Key @foreach (var stateEvent in group.OrderBy(x => x.OriginServerTs)) { }
Type Content
@stateEvent.Type
@stateEvent.RawContent.ToJson()
} @code { //get room list // - sync withroom list filter // Type = support.feline.msc3784 //support.feline.policy.lists.msc.v1 [Parameter] public string? RoomId { get; set; } public List FilteredEvents { get; set; } = new(); public List Events { get; set; } = new(); public string status = ""; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); var hs = await MRUStorage.GetCurrentSessionOrNavigate(); if (hs is null) return; await LoadStatesAsync(); Console.WriteLine("Policy list editor initialized!"); } private DateTime _lastUpdate = DateTime.Now; private async Task LoadStatesAsync() { var StateLoaded = 0; var hs = await MRUStorage.GetCurrentSessionOrNavigate(); if (hs is null) return; var response = (await hs.GetRoom(RoomId)).GetFullStateAsync(); await foreach (var _ev in response) { Events.Add(_ev); if (string.IsNullOrEmpty(_ev.StateKey)) { FilteredEvents.Add(_ev); } StateLoaded++; if (!((DateTime.Now - _lastUpdate).TotalMilliseconds > 100)) continue; _lastUpdate = DateTime.Now; status = $"Loaded {StateLoaded} state events"; StateHasChanged(); await Task.Delay(0); } StateHasChanged(); } private async Task RebuildFilteredData() { status = "Rebuilding filtered data..."; StateHasChanged(); await Task.Delay(1); var _FilteredEvents = Events; if (!ShowMembershipEvents) _FilteredEvents = _FilteredEvents.Where(x => x.Type != "m.room.member").ToList(); status = "Done, rerendering!"; StateHasChanged(); await Task.Delay(1); FilteredEvents = _FilteredEvents; StateHasChanged(); } public bool ShowMembershipEvents { get => _showMembershipEvents; set { _showMembershipEvents = value; RebuildFilteredData(); } } private bool _showMembershipEvents; }