diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index ff2b25a6..f47399f1 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -1101,23 +1101,29 @@ async fn load_joined_room( .map(|(_, pdu)| pdu.to_sync_room_event()) .collect(); - let mut edus: Vec<_> = services() - .rooms - .read_receipt - .readreceipts_since(room_id, since) - .filter_map(Result::ok) // Filter out buggy events - .map(|(_, _, v)| v) - .collect(); + let edus = if filter.room.ephemeral.room_allowed(room_id) { + let mut edus: Vec<_> = services() + .rooms + .read_receipt + .readreceipts_since(room_id, since) + .filter_map(Result::ok) // Filter out buggy events + .map(|(_, _, v)| v) + .collect(); - if services().rooms.typing.last_typing_update(room_id).await? > since { - edus.push( - serde_json::from_str( - &serde_json::to_string(&services().rooms.typing.typings_all(room_id).await?) - .expect("event is valid, we just created it"), - ) - .expect("event is valid, we just created it"), - ); - } + if services().rooms.typing.last_typing_update(room_id).await? > since { + edus.push( + serde_json::from_str( + &serde_json::to_string(&services().rooms.typing.typings_all(room_id).await?) + .expect("event is valid, we just created it"), + ) + .expect("event is valid, we just created it"), + ); + } + + edus + } else { + vec![] + }; // Save the state after this sync so we can send the correct state diff next // sync diff --git a/src/utils/filter.rs b/src/utils/filter.rs index 4e12074a..adea0dda 100644 --- a/src/utils/filter.rs +++ b/src/utils/filter.rs @@ -137,6 +137,7 @@ pub(crate) struct CompiledFilterDefinition<'a> { pub(crate) struct CompiledRoomFilter<'a> { rooms: AllowDenyList<'a, RoomId>, pub(crate) timeline: CompiledRoomEventFilter<'a>, + pub(crate) ephemeral: CompiledRoomEventFilter<'a>, pub(crate) state: CompiledRoomEventFilter<'a>, } @@ -168,6 +169,7 @@ impl<'a> TryFrom<&'a RoomFilter> for CompiledRoomFilter<'a> { // all of the sub-filters rooms: AllowDenyList::from_slices(source.rooms.as_deref(), &source.not_rooms), timeline: (&source.timeline).try_into()?, + ephemeral: (&source.ephemeral).try_into()?, state: (&source.state).try_into()?, }) }