mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 00:31:24 +01:00
implement room.account_data.(not_)rooms filter on /sync
This commit is contained in:
parent
84f356e67b
commit
745eaa9b48
2 changed files with 23 additions and 14 deletions
|
|
@ -951,17 +951,9 @@ async fn load_joined_room(
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save the state after this sync so we can send the correct state diff next
|
let account_data_events = if filter.room.account_data.room_allowed(room_id)
|
||||||
// sync
|
{
|
||||||
services().rooms.user.associate_token_shortstatehash(
|
services()
|
||||||
room_id,
|
|
||||||
next_batch,
|
|
||||||
current_shortstatehash,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
Ok(JoinedRoom {
|
|
||||||
account_data: RoomAccountData {
|
|
||||||
events: services()
|
|
||||||
.account_data
|
.account_data
|
||||||
.changes_since(Some(room_id), sender_user, since)?
|
.changes_since(Some(room_id), sender_user, since)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
@ -974,7 +966,22 @@ async fn load_joined_room(
|
||||||
})
|
})
|
||||||
.ok()
|
.ok()
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect()
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Save the state after this sync so we can send the correct state diff next
|
||||||
|
// sync
|
||||||
|
services().rooms.user.associate_token_shortstatehash(
|
||||||
|
room_id,
|
||||||
|
next_batch,
|
||||||
|
current_shortstatehash,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(JoinedRoom {
|
||||||
|
account_data: RoomAccountData {
|
||||||
|
events: account_data_events,
|
||||||
},
|
},
|
||||||
summary: RoomSummary {
|
summary: RoomSummary {
|
||||||
heroes,
|
heroes,
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,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) account_data: CompiledRoomEventFilter<'a>,
|
||||||
pub(crate) timeline: CompiledRoomEventFilter<'a>,
|
pub(crate) timeline: CompiledRoomEventFilter<'a>,
|
||||||
pub(crate) ephemeral: 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.rooms.as_deref(),
|
source.rooms.as_deref(),
|
||||||
&source.not_rooms,
|
&source.not_rooms,
|
||||||
),
|
),
|
||||||
|
account_data: (&source.account_data).try_into()?,
|
||||||
timeline: (&source.timeline).try_into()?,
|
timeline: (&source.timeline).try_into()?,
|
||||||
ephemeral: (&source.ephemeral).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