forked from MirrorHub/mautrix-whatsapp
Merge pull request #408 from mautrix/double-puppeting-key-for-redactions
double puppeting: add flag to redaction events
This commit is contained in:
commit
cb3a9a381c
3 changed files with 9 additions and 5 deletions
2
go.mod
2
go.mod
|
@ -14,7 +14,7 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
maunium.net/go/mauflag v1.0.0
|
||||
maunium.net/go/maulogger/v2 v2.3.1
|
||||
maunium.net/go/mautrix v0.10.6-0.20211206194350-22ee22dccd9f
|
||||
maunium.net/go/mautrix v0.10.7-0.20211216152136-eead69535244
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -221,5 +221,5 @@ maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
|
|||
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
|
||||
maunium.net/go/maulogger/v2 v2.3.1 h1:fwBYJne0pHvJrrIPHK+TAPfyxxbBEz46oVGez2x0ODE=
|
||||
maunium.net/go/maulogger/v2 v2.3.1/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
|
||||
maunium.net/go/mautrix v0.10.6-0.20211206194350-22ee22dccd9f h1:xa2THJban4GMeZ5g6g0vMK/KZ1cmEpVtcIuwyyNTeDU=
|
||||
maunium.net/go/mautrix v0.10.6-0.20211206194350-22ee22dccd9f/go.mod h1:k4Ng5oci83MEbqPL6KOjPdbU7f8v01KlMjR/zTQ+7mA=
|
||||
maunium.net/go/mautrix v0.10.7-0.20211216152136-eead69535244 h1:T5kmB+OjrLkcZ8VQYTgHNQ7FllFsr6klb/JtOrldUhs=
|
||||
maunium.net/go/mautrix v0.10.7-0.20211216152136-eead69535244/go.mod h1:k4Ng5oci83MEbqPL6KOjPdbU7f8v01KlMjR/zTQ+7mA=
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue