mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-12 06:36:24 +02:00
implement room.ephemeral.(not_)rooms filter on /sync
This commit is contained in:
parent
0aae761da4
commit
0c3d1e5745
2 changed files with 24 additions and 16 deletions
|
@ -1101,6 +1101,7 @@ async fn load_joined_room(
|
||||||
.map(|(_, pdu)| pdu.to_sync_room_event())
|
.map(|(_, pdu)| pdu.to_sync_room_event())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let edus = if filter.room.ephemeral.room_allowed(room_id) {
|
||||||
let mut edus: Vec<_> = services()
|
let mut edus: Vec<_> = services()
|
||||||
.rooms
|
.rooms
|
||||||
.read_receipt
|
.read_receipt
|
||||||
|
@ -1119,6 +1120,11 @@ async fn load_joined_room(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edus
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
|
||||||
// Save the state after this sync so we can send the correct state diff next
|
// Save the state after this sync so we can send the correct state diff next
|
||||||
// sync
|
// sync
|
||||||
services()
|
services()
|
||||||
|
|
|
@ -137,6 +137,7 @@ pub(crate) struct CompiledFilterDefinition<'a> {
|
||||||
pub(crate) struct CompiledRoomFilter<'a> {
|
pub(crate) struct CompiledRoomFilter<'a> {
|
||||||
rooms: AllowDenyList<'a, RoomId>,
|
rooms: AllowDenyList<'a, RoomId>,
|
||||||
pub(crate) timeline: CompiledRoomEventFilter<'a>,
|
pub(crate) timeline: CompiledRoomEventFilter<'a>,
|
||||||
|
pub(crate) ephemeral: CompiledRoomEventFilter<'a>,
|
||||||
pub(crate) state: CompiledRoomEventFilter<'a>,
|
pub(crate) state: CompiledRoomEventFilter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +169,7 @@ impl<'a> TryFrom<&'a RoomFilter> for CompiledRoomFilter<'a> {
|
||||||
// all of the sub-filters
|
// all of the sub-filters
|
||||||
rooms: AllowDenyList::from_slices(source.rooms.as_deref(), &source.not_rooms),
|
rooms: AllowDenyList::from_slices(source.rooms.as_deref(), &source.not_rooms),
|
||||||
timeline: (&source.timeline).try_into()?,
|
timeline: (&source.timeline).try_into()?,
|
||||||
|
ephemeral: (&source.ephemeral).try_into()?,
|
||||||
state: (&source.state).try_into()?,
|
state: (&source.state).try_into()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue