mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
SSS: factor out account data extension
This commit is contained in:
parent
f5ff294c3e
commit
395d16ca22
1 changed files with 19 additions and 19 deletions
|
|
@ -474,6 +474,24 @@ pub(crate) async fn sync_events_v5_route(
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let account_data = if body.extensions.account_data.enabled == Some(true) {
|
||||||
|
let global = services()
|
||||||
|
.account_data
|
||||||
|
.global_changes_since(&sender_user, globalsince)?
|
||||||
|
.into_iter()
|
||||||
|
.map(|(event_type, content)| {
|
||||||
|
account_data::raw_global_event_from_parts(&event_type, &content)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Some(sync_events::v5::response::AccountData {
|
||||||
|
global,
|
||||||
|
rooms: BTreeMap::new(),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut rooms = BTreeMap::new();
|
let mut rooms = BTreeMap::new();
|
||||||
for (room_id, todo_room) in todo_rooms {
|
for (room_id, todo_room) in todo_rooms {
|
||||||
if let Some(room) = process_room(&sender_user, &room_id, &todo_room)? {
|
if let Some(room) = process_room(&sender_user, &room_id, &todo_room)? {
|
||||||
|
|
@ -505,25 +523,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||||
extensions: sync_events::v5::response::Extensions {
|
extensions: sync_events::v5::response::Extensions {
|
||||||
to_device,
|
to_device,
|
||||||
e2ee: e2ee.unwrap_or_default(),
|
e2ee: e2ee.unwrap_or_default(),
|
||||||
account_data: sync_events::v5::response::AccountData {
|
account_data: account_data.unwrap_or_default(),
|
||||||
global: if body.extensions.account_data.enabled.unwrap_or(false)
|
|
||||||
{
|
|
||||||
services()
|
|
||||||
.account_data
|
|
||||||
.global_changes_since(&sender_user, globalsince)?
|
|
||||||
.into_iter()
|
|
||||||
.map(|(event_type, content)| {
|
|
||||||
account_data::raw_global_event_from_parts(
|
|
||||||
&event_type,
|
|
||||||
&content,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
} else {
|
|
||||||
Vec::new()
|
|
||||||
},
|
|
||||||
rooms: BTreeMap::new(),
|
|
||||||
},
|
|
||||||
receipts: sync_events::v5::response::Receipts {
|
receipts: sync_events::v5::response::Receipts {
|
||||||
rooms: BTreeMap::new(),
|
rooms: BTreeMap::new(),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue