mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 00:31:24 +01:00
implement room.ephemeral.(not_)rooms filter on /sync
This commit is contained in:
parent
4e1d091bbc
commit
84f356e67b
2 changed files with 32 additions and 17 deletions
|
|
@ -917,26 +917,39 @@ async fn load_joined_room(
|
||||||
let room_events: Vec<_> =
|
let room_events: Vec<_> =
|
||||||
timeline_pdus.iter().map(|(_, pdu)| pdu.to_sync_room_event()).collect();
|
timeline_pdus.iter().map(|(_, pdu)| pdu.to_sync_room_event()).collect();
|
||||||
|
|
||||||
let mut edus: Vec<_> = services()
|
let edus = if filter.room.ephemeral.room_allowed(room_id) {
|
||||||
.rooms
|
let mut edus: Vec<_> = services()
|
||||||
.edus
|
.rooms
|
||||||
.read_receipt
|
.edus
|
||||||
.readreceipts_since(room_id, since)
|
.read_receipt
|
||||||
.filter_map(Result::ok)
|
.readreceipts_since(room_id, since)
|
||||||
.map(|(_, _, v)| v)
|
.filter_map(Result::ok)
|
||||||
.collect();
|
.map(|(_, _, v)| v)
|
||||||
|
.collect();
|
||||||
|
|
||||||
if services().rooms.edus.typing.last_typing_update(room_id).await? > since {
|
if services().rooms.edus.typing.last_typing_update(room_id).await?
|
||||||
edus.push(
|
> since
|
||||||
serde_json::from_str(
|
{
|
||||||
&serde_json::to_string(
|
edus.push(
|
||||||
&services().rooms.edus.typing.typings_all(room_id).await?,
|
serde_json::from_str(
|
||||||
|
&serde_json::to_string(
|
||||||
|
&services()
|
||||||
|
.rooms
|
||||||
|
.edus
|
||||||
|
.typing
|
||||||
|
.typings_all(room_id)
|
||||||
|
.await?,
|
||||||
|
)
|
||||||
|
.expect("event is valid, we just created it"),
|
||||||
)
|
)
|
||||||
.expect("event is valid, we just created it"),
|
.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
|
// Save the state after this sync so we can send the correct state diff next
|
||||||
// sync
|
// sync
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,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>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,6 +199,7 @@ impl<'a> TryFrom<&'a RoomFilter> for CompiledRoomFilter<'a> {
|
||||||
&source.not_rooms,
|
&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
Add a link
Reference in a new issue