diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-04-05 18:58:32 +0200 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-04-05 18:58:32 +0200 |
commit | 37b97d65c0a5262539a5de560e911048166b8bba (patch) | |
tree | f704a9c703b0ec47122a460576e151e0cb06fdc6 /Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs | |
parent | Fix merge conficts between machines (diff) | |
download | LibMatrix-37b97d65c0a5262539a5de560e911048166b8bba.tar.xz |
Fix homeserver resolution, rewrite homeserver initialisation, HSE work
Diffstat (limited to 'Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs')
-rw-r--r-- | Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs b/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs index 1d03d7a..d938b1b 100644 --- a/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs +++ b/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs @@ -14,5 +14,11 @@ public static class EventExtensions { OriginServerTs = DateTimeOffset.Now.ToUnixTimeMilliseconds() }; } - + + public static List<StateEventResponse> GetCalculatedState(this IEnumerable<StateEventResponse> events) { + return events.Where(s => s.StateKey != null) + .OrderByDescending(s => s.OriginServerTs) + .DistinctBy(x => (x.Type, x.StateKey)) + .ToList(); + } } \ No newline at end of file |