Compare commits

...

1 commit

Author SHA1 Message Date
Timo Kösters
3ff574af81
fix: repair after broken join
The bug that caused broken joins was fixed here:
a5f004d7e9

But that commit doesn't repair those joins afterwards because the broken
join event is still in the auth chain. This commit will leave out the
the member join event from the auth_events in leave->* transitions.

Also see https://github.com/matrix-org/matrix-doc/issues/3695
2022-02-03 11:44:29 +01:00

View file

@ -295,6 +295,22 @@ impl Rooms {
sauthevents.remove(&shortstatekey).map(|k| (k, event_id))
})
.filter_map(|(k, event_id)| self.get_pdu(&event_id).ok().flatten().map(|pdu| (k, pdu)))
.filter(|(_, pdu)| {
if pdu.kind != EventType::RoomMember {
return true;
}
#[derive(Deserialize)]
struct ExtractMembership {
membership: MembershipState,
}
// Leave out auth events where the membership is leave
match serde_json::from_str::<ExtractMembership>(pdu.content.get()) {
Ok(e) => e.membership != MembershipState::Leave,
Err(_) => true,
}
})
.collect())
}