Browse Source

double puppeting: add flag to redaction events

Sumner Evans 3 years ago
parent
commit
76530f5774
1 changed files with 6 additions and 2 deletions
  1. 6 2
      portal.go

+ 6 - 2
portal.go

@@ -1236,10 +1236,14 @@ func (portal *Portal) HandleMessageRevoke(user *User, info *types.MessageInfo, k
 		return false
 	}
 	intent := portal.bridge.GetPuppetByJID(info.Sender).IntentFor(portal)
-	_, err := intent.RedactEvent(portal.MXID, msg.MXID)
+	redactionReq := mautrix.ReqRedact{Extra: map[string]interface{}{}}
+	if intent.IsCustomPuppet {
+		redactionReq.Extra[doublePuppetKey] = doublePuppetValue
+	}
+	_, err := intent.RedactEvent(portal.MXID, msg.MXID, redactionReq)
 	if err != nil {
 		if errors.Is(err, mautrix.MForbidden) {
-			_, err = portal.MainIntent().RedactEvent(portal.MXID, msg.MXID)
+			_, err = portal.MainIntent().RedactEvent(portal.MXID, msg.MXID, redactionReq)
 			if err != nil {
 				portal.log.Errorln("Failed to redact %s: %v", msg.JID, err)
 			}