Backport fixing custom fields leaking in history sync

This commit is contained in:
Tulir Asokan 2022-04-16 23:16:05 +03:00
parent 2142f92089
commit a58cae16cd

View file

@ -478,6 +478,13 @@ func (portal *Portal) wrapBatchEvent(info *types.MessageInfo, intent *appservice
if err != nil {
return nil, err
}
if newEventType == 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,