Check prev_content for all leave events

This commit is contained in:
Tulir Asokan 2021-11-01 12:52:51 +02:00
parent d24a8821c1
commit c85b003fe8

View file

@ -274,7 +274,6 @@ func (mx *MatrixHandler) HandleMembership(evt *event.Event) {
isSelf := id.UserID(evt.GetStateKey()) == evt.Sender isSelf := id.UserID(evt.GetStateKey()) == evt.Sender
if content.Membership == event.MembershipLeave { if content.Membership == event.MembershipLeave {
if isSelf {
if evt.Unsigned.PrevContent != nil { if evt.Unsigned.PrevContent != nil {
_ = evt.Unsigned.PrevContent.ParseRaw(evt.Type) _ = evt.Unsigned.PrevContent.ParseRaw(evt.Type)
prevContent, ok := evt.Unsigned.PrevContent.Parsed.(*event.MemberEventContent) prevContent, ok := evt.Unsigned.PrevContent.Parsed.(*event.MemberEventContent)
@ -282,6 +281,7 @@ func (mx *MatrixHandler) HandleMembership(evt *event.Event) {
return return
} }
} }
if isSelf {
portal.HandleMatrixLeave(user) portal.HandleMatrixLeave(user)
} else { } else {
portal.HandleMatrixKick(user, evt) portal.HandleMatrixKick(user, evt)