diff options
author | Emma@Rory& <root@rory.gay> | 2023-08-14 19:46:33 +0200 |
---|---|---|
committer | Emma@Rory& <root@rory.gay> | 2023-08-14 19:46:33 +0200 |
commit | 83029c478f411bcadd3be53ac4dc53d88b3c8462 (patch) | |
tree | 279d62e53e55e862e4851f1447de12e47e3fce62 /MatrixRoomUtils.Web/Pages/Rooms/Index.razor | |
parent | Add MxApiExtensions submodule (diff) | |
download | MatrixUtils-83029c478f411bcadd3be53ac4dc53d88b3c8462.tar.xz |
Code cleanup
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/Rooms/Index.razor')
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/Index.razor | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor index 89ededf..ad3a714 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor @@ -19,25 +19,25 @@ private ProfileResponseEventData GlobalProfile { get; set; } private SyncFilter filter = new() { - AccountData = new() { - NotTypes = new() { "*" }, + AccountData = new SyncFilter.EventFilter { + NotTypes = new List<string> { "*" }, Limit = 1 }, - Presence = new() { - NotTypes = new() { "*" }, + Presence = new SyncFilter.EventFilter { + NotTypes = new List<string> { "*" }, Limit = 1 }, - Room = new() { - AccountData = new() { - NotTypes = new() { "*" }, + Room = new SyncFilter.RoomFilter { + AccountData = new SyncFilter.RoomFilter.StateFilter { + NotTypes = new List<string> { "*" }, Limit = 1 }, - Ephemeral = new() { - NotTypes = new() { "*" }, + Ephemeral = new SyncFilter.RoomFilter.StateFilter { + NotTypes = new List<string> { "*" }, Limit = 1 }, - State = new() { - Types = new List<string>() { + State = new SyncFilter.RoomFilter.StateFilter { + Types = new List<string> { "m.room.name", "m.room.avatar", "m.room.create", @@ -45,8 +45,8 @@ "m.room.power_levels" } }, - Timeline = new() { - NotTypes = new() { "*" }, + Timeline = new SyncFilter.RoomFilter.StateFilter { + NotTypes = new List<string> { "*" }, Limit = 1 } } @@ -74,9 +74,9 @@ room = Rooms.First(x => x.Room.RoomId == roomId); } else { - room = new RoomInfo() { + room = new RoomInfo { Room = await hs.GetRoom(roomId), - StateEvents = new() + StateEvents = new List<StateEventResponse?>() }; Rooms.Add(room); KnownRooms.Add(room); @@ -91,23 +91,23 @@ Status = "Sync complete!"; foreach (var roomInfo in Rooms) { if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.name")) { - roomInfo.StateEvents.Add(new StateEventResponse() { + roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.name", - TypedContent = new RoomNameEventData() { + TypedContent = new RoomNameEventData { Name = roomInfo.Room.RoomId } }); } if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.avatar")) { - roomInfo.StateEvents.Add(new StateEventResponse() { + roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.avatar", - TypedContent = new RoomAvatarEventData() { + TypedContent = new RoomAvatarEventData { } }); } if (!roomInfo.StateEvents.Any(x => x.Type == "org.matrix.mjolnir.shortcode")) { - roomInfo.StateEvents.Add(new StateEventResponse() { + roomInfo.StateEvents.Add(new StateEventResponse { Type = "org.matrix.mjolnir.shortcode" }); } @@ -118,10 +118,10 @@ var memberTasks = Rooms.Select(async roomInfo => { if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.member" && x.StateKey == hs.WhoAmI.UserId)) { await semaphore.WaitAsync(); - roomInfo.StateEvents.Add(new StateEventResponse() { + roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.member", StateKey = hs.WhoAmI.UserId, - TypedContent = await roomInfo.Room.GetStateAsync<RoomMemberEventData>("m.room.member", hs.WhoAmI.UserId) ?? new RoomMemberEventData() { + TypedContent = await roomInfo.Room.GetStateAsync<RoomMemberEventData>("m.room.member", hs.WhoAmI.UserId) ?? new RoomMemberEventData { Membership = "unknown" } }); @@ -148,7 +148,7 @@ await base.OnInitializedAsync(); } - private bool RenderContents { get; set; } = false; + private bool RenderContents { get; set; } private string _status; |