Update GetEvent + Invite endpoint to new Enveloped Http Log type

4-compiler-bug
Bram 2024-05-22 19:17:21 +02:00
parent e786bebeb2
commit becd3bcdb1
2 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import Internal.Api.Request as R
import Internal.Config.Log exposing (log)
import Internal.Tools.Json as Json
import Internal.Tools.Timestamp as Timestamp
import Internal.Values.Envelope as E
import Internal.Values.Event as Event exposing (Event)
import Internal.Values.Room as Room
import Internal.Values.User as User
@ -82,7 +83,7 @@ getEventV1 { eventId, roomId } =
, path = [ "_matrix", "client", "r0", "rooms", roomId, "event", eventId ]
, toUpdate =
\event ->
( V.MapRoom roomId (Room.AddEvent event)
( E.ContentUpdate <| V.MapRoom roomId (Room.AddEvent event)
, event.eventId
|> (++) "Received event id "
|> log.debug
@ -106,7 +107,7 @@ getEventV2 { eventId, roomId } =
, path = [ "_matrix", "client", "v3", "rooms", roomId, "event", eventId ]
, toUpdate =
\event ->
( V.MapRoom roomId (Room.AddEvent event)
( E.ContentUpdate <| V.MapRoom roomId (Room.AddEvent event)
, event.eventId
|> (++) "Received event id "
|> log.debug

View File

@ -22,6 +22,7 @@ import Internal.Api.Api as A
import Internal.Api.Request as R
import Internal.Config.Log exposing (log)
import Internal.Tools.Json as Json
import Internal.Values.Envelope as E
import Internal.Values.Room as Room
import Internal.Values.User as User exposing (User)
import Internal.Values.Vault as V
@ -93,7 +94,7 @@ inviteV1 { roomId, user } =
, path = [ "_matrix", "client", "r0", "rooms", roomId, "invite" ]
, toUpdate =
always
( V.MapRoom roomId (Room.Invite user)
( E.ContentUpdate <| V.MapRoom roomId (Room.Invite user)
, String.concat
-- TODO: Move to Internal.Config.Text
[ "Invited user "
@ -123,7 +124,7 @@ inviteV2 { reason, roomId, user } =
, path = [ "_matrix", "client", "v3", "rooms", roomId, "invite" ]
, toUpdate =
always
( V.MapRoom roomId (Room.Invite user)
( E.ContentUpdate <| V.MapRoom roomId (Room.Invite user)
, String.concat
-- TODO: Move to Internal.Config.Text
[ "Invited user "