From 7618afed7f8744e6cc25f180017e0e90f9495bd5 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 2 Aug 2023 14:37:01 +0300 Subject: [PATCH] Log conversation data when syncing (ref #6) --- portal.go | 1 - user.go | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/portal.go b/portal.go index e49f674..8b82b65 100644 --- a/portal.go +++ b/portal.go @@ -724,7 +724,6 @@ func (portal *Portal) SyncParticipants(source *User, metadata *gmproto.Conversat } else { manyParticipants = true } - portal.zlog.Trace().Interface("participant", participant).Msg("Syncing participant") puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number) if puppet == nil { portal.zlog.Error().Any("participant_id", participant.ID).Msg("Failed to get puppet for participant") diff --git a/user.go b/user.go index e5cf438..ad76c1b 100644 --- a/user.go +++ b/user.go @@ -28,6 +28,7 @@ import ( "time" "github.com/rs/zerolog" + "google.golang.org/protobuf/proto" "maunium.net/go/maulogger/v2" "maunium.net/go/maulogger/v2/maulogadapt" "maunium.net/go/mautrix" @@ -795,9 +796,13 @@ func (user *User) Logout(state status.BridgeState, unpair bool) (logoutOK bool) func (user *User) syncConversation(v *gmproto.Conversation) { updateType := v.GetStatus() portal := user.GetPortalByID(v.GetConversationID()) + convCopy := proto.Clone(v).(*gmproto.Conversation) + convCopy.LatestMessage = nil log := portal.zlog.With(). Str("action", "sync conversation"). Str("conversation_status", updateType.String()). + Str("room_id", portal.MXID.String()). + Interface("conversation_data", convCopy). Logger() if portal.MXID != "" { switch updateType {