mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 16:51: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,6 +951,26 @@ async fn load_joined_room(
|
|||
vec![]
|
||||
};
|
||||
|
||||
let account_data_events = if filter.room.account_data.room_allowed(room_id)
|
||||
{
|
||||
services()
|
||||
.account_data
|
||||
.changes_since(Some(room_id), sender_user, since)?
|
||||
.into_iter()
|
||||
.filter_map(|(_, v)| {
|
||||
serde_json::from_str(v.json().get())
|
||||
.map_err(|_| {
|
||||
Error::bad_database(
|
||||
"Invalid account event in database.",
|
||||
)
|
||||
})
|
||||
.ok()
|
||||
})
|
||||
.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(
|
||||
|
|
@ -961,20 +981,7 @@ async fn load_joined_room(
|
|||
|
||||
Ok(JoinedRoom {
|
||||
account_data: RoomAccountData {
|
||||
events: services()
|
||||
.account_data
|
||||
.changes_since(Some(room_id), sender_user, since)?
|
||||
.into_iter()
|
||||
.filter_map(|(_, v)| {
|
||||
serde_json::from_str(v.json().get())
|
||||
.map_err(|_| {
|
||||
Error::bad_database(
|
||||
"Invalid account event in database.",
|
||||
)
|
||||
})
|
||||
.ok()
|
||||
})
|
||||
.collect(),
|
||||
events: account_data_events,
|
||||
},
|
||||
summary: RoomSummary {
|
||||
heroes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue