mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 00:31:24 +01:00
implement filter.room.include_leave for /sync
This commit is contained in:
parent
d69b88566a
commit
c3cf97df7a
1 changed files with 32 additions and 25 deletions
|
|
@ -186,34 +186,41 @@ pub(crate) async fn sync_events_route(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut left_rooms = BTreeMap::new();
|
let mut left_rooms = BTreeMap::new();
|
||||||
let mut all_left_rooms = Vec::new();
|
if filter.room.include_leave {
|
||||||
if let AllowDenyList::Allow(allow_set) = room_filter {
|
let mut all_left_rooms = Vec::new();
|
||||||
for &room_id in allow_set {
|
if let AllowDenyList::Allow(allow_set) = room_filter {
|
||||||
if services().rooms.state_cache.is_left(&sender_user, room_id)? {
|
for &room_id in allow_set {
|
||||||
all_left_rooms.push(room_id.to_owned());
|
if services()
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_left(&sender_user, room_id)?
|
||||||
|
{
|
||||||
|
all_left_rooms.push(room_id.to_owned());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for result in services().rooms.state_cache.rooms_left(&sender_user)
|
||||||
|
{
|
||||||
|
let (room_id, _) = result?;
|
||||||
|
if room_filter.allowed(&room_id) {
|
||||||
|
all_left_rooms.push(room_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for result in services().rooms.state_cache.rooms_left(&sender_user) {
|
|
||||||
let (room_id, _) = result?;
|
|
||||||
if room_filter.allowed(&room_id) {
|
|
||||||
all_left_rooms.push(room_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for room_id in all_left_rooms {
|
for room_id in all_left_rooms {
|
||||||
handle_left_room(
|
handle_left_room(
|
||||||
room_id,
|
room_id,
|
||||||
&sender_user,
|
&sender_user,
|
||||||
&mut left_rooms,
|
&mut left_rooms,
|
||||||
since,
|
since,
|
||||||
&next_batch_string,
|
&next_batch_string,
|
||||||
full_state,
|
full_state,
|
||||||
lazy_load_enabled,
|
lazy_load_enabled,
|
||||||
&compiled_filter,
|
&compiled_filter,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut invited_rooms = BTreeMap::new();
|
let mut invited_rooms = BTreeMap::new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue