mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 13:03:47 +03:00
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
This commit is contained in:
parent
9ef3abacd4
commit
3ff574af81
1 changed files with 16 additions and 0 deletions
|
@ -295,6 +295,22 @@ impl Rooms {
|
||||||
sauthevents.remove(&shortstatekey).map(|k| (k, event_id))
|
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_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())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue