Ignore missing prev_content in matrix leave handler

This commit is contained in:
Tulir Asokan 2021-11-01 12:42:34 +02:00
parent 06a3346d28
commit d24a8821c1

View file

@ -278,12 +278,11 @@ func (mx *MatrixHandler) HandleMembership(evt *event.Event) {
if evt.Unsigned.PrevContent != nil {
_ = evt.Unsigned.PrevContent.ParseRaw(evt.Type)
prevContent, ok := evt.Unsigned.PrevContent.Parsed.(*event.MemberEventContent)
if ok {
if portal.IsPrivateChat() || prevContent.Membership == "join" {
portal.HandleMatrixLeave(user)
}
if ok && prevContent.Membership != "join" {
return
}
}
portal.HandleMatrixLeave(user)
} else {
portal.HandleMatrixKick(user, evt)
}