fix api/client_server/context events

This commit is contained in:
Charles Hall 2024-07-15 20:52:41 -07:00
parent 4b9c6a754c
commit dacb2ae7dd
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -159,19 +159,21 @@ pub(crate) async fn get_context_route(
let mut state = Vec::new();
for (shortstatekey, id) in state_ids {
for (shortstatekey, event_id) in state_ids {
let (event_type, state_key) =
services().rooms.short.get_statekey_from_short(shortstatekey)?;
if event_type != StateEventType::RoomMember {
let Some(pdu) = services().rooms.timeline.get_pdu(&id)? else {
error!("Pdu in state not found: {}", id);
let Some(pdu) = services().rooms.timeline.get_pdu(&event_id)?
else {
error!(%event_id, "Event in state not found");
continue;
};
state.push(pdu.to_state_event());
} else if !lazy_load_enabled || lazy_loaded.contains(&state_key) {
let Some(pdu) = services().rooms.timeline.get_pdu(&id)? else {
error!("Pdu in state not found: {}", id);
let Some(pdu) = services().rooms.timeline.get_pdu(&event_id)?
else {
error!(%event_id, "Event in state not found");
continue;
};
state.push(pdu.to_state_event());