diff --git a/historysync.go b/historysync.go index 9565fd0..8800a39 100644 --- a/historysync.go +++ b/historysync.go @@ -532,6 +532,15 @@ func (portal *Portal) wrapBatchEvent(info *types.MessageInfo, intent *appservice if err != nil { return nil, err } + + if eventType == event.EventEncrypted { + // Clear other custom keys if the event was encrypted, but keep the double puppet identifier + wrappedContent.Raw = map[string]interface{}{backfillIDField: info.ID} + if intent.IsCustomPuppet { + wrappedContent.Raw[doublePuppetKey] = doublePuppetValue + } + } + return &event.Event{ Sender: intent.UserID, Type: newEventType,