|
|
@ -1056,6 +1056,23 @@ fn get_missing_events(
|
|
|
|
latest_events: &[OwnedEventId],
|
|
|
|
latest_events: &[OwnedEventId],
|
|
|
|
limit: UInt,
|
|
|
|
limit: UInt,
|
|
|
|
) -> Result<Vec<Box<RawJsonValue>>> {
|
|
|
|
) -> Result<Vec<Box<RawJsonValue>>> {
|
|
|
|
|
|
|
|
let (room_members, room_errors): (Vec<_>, Vec<_>) = services()
|
|
|
|
|
|
|
|
.rooms
|
|
|
|
|
|
|
|
.state_cache
|
|
|
|
|
|
|
|
.room_members(room_id)
|
|
|
|
|
|
|
|
.partition(Result::is_ok);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Just log errors and continue with correct users
|
|
|
|
|
|
|
|
if !room_errors.is_empty() {
|
|
|
|
|
|
|
|
warn!(?room_id, "Some errors occurred when fetching room members");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let current_server_members: Vec<OwnedUserId> = room_members
|
|
|
|
|
|
|
|
.into_iter()
|
|
|
|
|
|
|
|
.map(Result::unwrap)
|
|
|
|
|
|
|
|
.filter(|member| member.server_name() == sender_servername)
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
let limit = u64::from(limit) as usize;
|
|
|
|
let limit = u64::from(limit) as usize;
|
|
|
|
|
|
|
|
|
|
|
|
let mut queued_events = latest_events.to_owned();
|
|
|
|
let mut queued_events = latest_events.to_owned();
|
|
|
@ -1092,23 +1109,6 @@ fn get_missing_events(
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let (room_members, room_errors): (Vec<_>, Vec<_>) = services()
|
|
|
|
|
|
|
|
.rooms
|
|
|
|
|
|
|
|
.state_cache
|
|
|
|
|
|
|
|
.room_members(room_id)
|
|
|
|
|
|
|
|
.partition(Result::is_ok);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Just log errors and continue with correct users
|
|
|
|
|
|
|
|
if !room_errors.is_empty() {
|
|
|
|
|
|
|
|
warn!(?room_id, "Some errors occurred when fetching room members");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let current_server_members: Vec<OwnedUserId> = room_members
|
|
|
|
|
|
|
|
.into_iter()
|
|
|
|
|
|
|
|
.map(Result::unwrap)
|
|
|
|
|
|
|
|
.filter(|member| member.server_name() == sender_servername)
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let event_is_visible = services().rooms.state_accessor.server_can_see_event(
|
|
|
|
let event_is_visible = services().rooms.state_accessor.server_can_see_event(
|
|
|
|
sender_servername,
|
|
|
|
sender_servername,
|
|
|
|
current_server_members.as_slice(),
|
|
|
|
current_server_members.as_slice(),
|
|
|
|