From ae18c049338dfcb33f721eeeb0a05571e8bd87a9 Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 30 May 2024 08:02:40 +0000 Subject: Rename StateEvent to LegacyMatrixEvent --- .../Extensions/EventExtensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs') diff --git a/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs b/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs index d938b1b..a4c6aa8 100644 --- a/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs +++ b/Tests/LibMatrix.HomeserverEmulator/Extensions/EventExtensions.cs @@ -3,19 +3,19 @@ using LibMatrix.HomeserverEmulator.Services; namespace LibMatrix.HomeserverEmulator.Extensions; public static class EventExtensions { - public static StateEventResponse ToStateEvent(this StateEvent stateEvent, UserStore.User user, RoomStore.Room room) { - return new StateEventResponse { - RawContent = stateEvent.RawContent, + public static LegacyMatrixEventResponse ToStateEvent(this LegacyMatrixEvent legacyMatrixEvent, UserStore.User user, RoomStore.Room room) { + return new LegacyMatrixEventResponse { + RawContent = legacyMatrixEvent.RawContent, EventId = "$" + string.Join("", Random.Shared.GetItems("abcdefghijklmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ0123456789".ToCharArray(), 100)), RoomId = room.RoomId, Sender = user.UserId, - StateKey = stateEvent.StateKey, - Type = stateEvent.Type, + StateKey = legacyMatrixEvent.StateKey, + Type = legacyMatrixEvent.Type, OriginServerTs = DateTimeOffset.Now.ToUnixTimeMilliseconds() }; } - public static List GetCalculatedState(this IEnumerable events) { + public static List GetCalculatedState(this IEnumerable events) { return events.Where(s => s.StateKey != null) .OrderByDescending(s => s.OriginServerTs) .DistinctBy(x => (x.Type, x.StateKey)) -- cgit 1.4.1