From cd8163bb41d0c05f830c1cf874a973f21ef2814d Mon Sep 17 00:00:00 2001 From: Bram Date: Fri, 2 Feb 2024 12:57:38 +0100 Subject: [PATCH] Fix bugs --- elm.json | 21 +----------- src/Internal/Values/Event.elm | 60 +---------------------------------- 2 files changed, 2 insertions(+), 79 deletions(-) diff --git a/elm.json b/elm.json index 851903b..cf63307 100644 --- a/elm.json +++ b/elm.json @@ -26,26 +26,7 @@ "Internal.Values.Vault", "Matrix", "Matrix.Event", - "Matrix.Settings", - "Internal.Config.Default", - "Internal.Config.Leaks", - "Internal.Config.Text", - "Internal.Filter.Timeline", - "Internal.Tools.Decode", - "Internal.Tools.Encode", - "Internal.Tools.Hashdict", - "Internal.Tools.Iddict", - "Internal.Tools.Mashdict", - "Internal.Tools.Timestamp", - "Internal.Tools.VersionControl", - "Internal.Values.Context", - "Internal.Values.Envelope", - "Internal.Values.Event", - "Internal.Values.Settings", - "Internal.Values.StateManager", - "Internal.Values.Timeline", - "Internal.Values.Vault", - "Types" + "Matrix.Settings" ], "elm-version": "0.19.0 <= v < 0.20.0", "dependencies": { diff --git a/src/Internal/Values/Event.elm b/src/Internal/Values/Event.elm index a737eb3..71e18e6 100644 --- a/src/Internal/Values/Event.elm +++ b/src/Internal/Values/Event.elm @@ -35,6 +35,7 @@ of a room. import Internal.Config.Text as Text import Internal.Tools.Json as Json import Internal.Tools.Timestamp as Timestamp exposing (Timestamp) +import Json.Encode as E {-| The Event type occurs everywhere on a user's timeline. @@ -213,65 +214,6 @@ isEqual e1 e2 = isEqual se1 se2 -{-| Compare two events and determine whether they're identical. Used mostly for -testing purposes. --} -isEqual : Event -> Event -> Bool -isEqual e1 e2 = - if e1.eventId /= e2.eventId then - False - - else if e1.originServerTs /= e2.originServerTs then - False - - else if e1.roomId /= e2.roomId then - False - - else if e1.sender /= e2.sender then - False - - else if e1.stateKey /= e2.stateKey then - False - - else if e1.eventType /= e2.eventType then - False - - else - case ( e1.unsigned, e2.unsigned ) of - ( Nothing, Nothing ) -> - True - - ( Just _, Nothing ) -> - False - - ( Nothing, Just _ ) -> - False - - ( Just (UnsignedData d1), Just (UnsignedData d2) ) -> - if d1.age /= d2.age then - False - - else if d1.transactionId /= d2.transactionId then - False - - else if Maybe.map (E.encode 0) d1.prevContent /= Maybe.map (E.encode 0) d2.prevContent then - False - - else - case ( d1.redactedBecause, d2.redactedBecause ) of - ( Nothing, Nothing ) -> - True - - ( Nothing, Just _ ) -> - False - - ( Just _, Nothing ) -> - False - - ( Just se1, Just se2 ) -> - isEqual se1 se2 - - {-| Determine the previous `content` value for this event. This field is only a `Just value` if the event is a state event, and the Matrix Vault has permission to see the previous content.