separate account_data service methods for room vs global events

Previously we were mashing everything together as RoomAccountDataEvent,
even the global events. This technically worked, because of the hidden
custom fields on the ruma event types, but it's confusing and easy to
mess up. Separate methods with appropriate types are preferable.
This commit is contained in:
Olivia Lee 2025-03-23 02:08:38 -07:00
parent 6897f0ba34
commit 66210bc32d
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9
16 changed files with 349 additions and 361 deletions

View file

@ -644,17 +644,8 @@ pub(crate) async fn sync_events_v4_route(
{
services()
.account_data
.changes_since(None, &sender_user, globalsince)?
.into_iter()
.filter_map(|(_, v)| {
serde_json::from_str(v.json().get())
.map_err(|_| {
Error::bad_database(
"Invalid account event in database.",
)
})
.ok()
})
.global_changes_since(&sender_user, globalsince)?
.into_values()
.collect()
} else {
Vec::new()