Fix the bug that messages cannot be deleted synchronously if the room is created in the matrix client

(maybe there is a better way)
This commit is contained in:
zhaoYangguang 2020-12-14 19:25:07 +08:00
parent 16af59c848
commit da535e7346
1 changed files with 4 additions and 0 deletions

View File

@ -1338,6 +1338,10 @@ func (portal *Portal) HandleMessageRevokeSkype(user *User, message skype.Resourc
}
_, err := intent.RedactEvent(portal.MXID, msg.MXID)
if err != nil {
// TODO Maybe there is a better implementation
if strings.Index(err.Error(), "M_FORBIDDEN") > -1 {
_, err = portal.MainIntent().RedactEvent(portal.MXID, msg.MXID)
}
portal.log.Errorln("Failed to redact %s: %v", msg.JID, err)
return
}