batch send: fix plaintext content

Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Sumner Evans 2022-04-05 12:29:43 -06:00
parent a8be4b11a8
commit 173edfaaf1
No known key found for this signature in database
GPG key ID: 8904527AB50022FD

View file

@ -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,