瀏覽代碼

Only clear custom keys for encrypted events

Tulir Asokan 3 年之前
父節點
當前提交
d257c80327
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      portal.go

+ 7 - 4
portal.go

@@ -1476,10 +1476,13 @@ func (portal *Portal) sendMessage(intent *appservice.IntentAPI, eventType event.
 		return nil, err
 	}
 
-	if intent.IsCustomPuppet {
-		wrappedContent.Raw = map[string]interface{}{doublePuppetKey: doublePuppetValue}
-	} else {
-		wrappedContent.Raw = nil
+	if eventType == event.EventEncrypted {
+		// Clear other custom keys if the event was encrypted, but keep the double puppet identifier
+		if intent.IsCustomPuppet {
+			wrappedContent.Raw = map[string]interface{}{doublePuppetKey: doublePuppetValue}
+		} else {
+			wrappedContent.Raw = nil
+		}
 	}
 
 	_, _ = intent.UserTyping(portal.MXID, false, 0)