about summary refs log tree commit diff
path: root/Tests/LibMatrix.HomeserverEmulator/Extensions
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-04-05 18:58:32 +0200
committerEmma [it/its]@Rory& <root@rory.gay>2024-04-05 18:58:32 +0200
commit37b97d65c0a5262539a5de560e911048166b8bba (patch)
treef704a9c703b0ec47122a460576e151e0cb06fdc6 /Tests/LibMatrix.HomeserverEmulator/Extensions
parentFix merge conficts between machines (diff)
downloadLibMatrix-37b97d65c0a5262539a5de560e911048166b8bba.tar.xz
Fix homeserver resolution, rewrite homeserver initialisation, HSE work
Diffstat (limited to 'Tests/LibMatrix.HomeserverEmulator/Extensions')
-rw-r--r--Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs8
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