From 2e0b156de0725d61fe79f45ccf03d9bcac52f6b1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 30 Jul 2025 06:10:29 +0000 Subject: [PATCH] Fix missing user account data sync watcher. Signed-off-by: Jason Volk --- src/service/sync/mod.rs | 2 ++ src/service/sync/watch.rs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/service/sync/mod.rs b/src/service/sync/mod.rs index bc503683..400d68c3 100644 --- a/src/service/sync/mod.rs +++ b/src/service/sync/mod.rs @@ -27,6 +27,7 @@ pub struct Data { userroomid_highlightcount: Arc, pduid_pdu: Arc, keychangeid_userid: Arc, + roomuserdataid_accountdata: Arc, roomusertype_roomuserdataid: Arc, readreceiptid_readreceipt: Arc, userid_lastonetimekeyupdate: Arc, @@ -64,6 +65,7 @@ impl crate::Service for Service { userroomid_highlightcount: args.db["userroomid_highlightcount"].clone(), pduid_pdu: args.db["pduid_pdu"].clone(), keychangeid_userid: args.db["keychangeid_userid"].clone(), + roomuserdataid_accountdata: args.db["roomuserdataid_accountdata"].clone(), roomusertype_roomuserdataid: args.db["roomusertype_roomuserdataid"].clone(), readreceiptid_readreceipt: args.db["readreceiptid_readreceipt"].clone(), userid_lastonetimekeyupdate: args.db["userid_lastonetimekeyupdate"].clone(), diff --git a/src/service/sync/watch.rs b/src/service/sync/watch.rs index 433473ce..28c31c93 100644 --- a/src/service/sync/watch.rs +++ b/src/service/sync/watch.rs @@ -1,5 +1,5 @@ use futures::{FutureExt, StreamExt, pin_mut, stream::FuturesUnordered}; -use ruma::{DeviceId, UserId}; +use ruma::{DeviceId, RoomId, UserId}; use tuwunel_core::{Result, implement, trace}; use tuwunel_database::{Interfix, Separator, serialize_key}; @@ -8,6 +8,7 @@ use tuwunel_database::{Interfix, Separator, serialize_key}; pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result { let userdeviceid_prefix = (user_id, device_id, Interfix); let globaluserdata_prefix = (Separator, user_id, Interfix); + let roomuserdataid_prefix = (Option::<&RoomId>::None, user_id, Interfix); let userid_prefix = serialize_key((user_id, Interfix)).expect("failed to serialize watch prefix"); @@ -56,6 +57,11 @@ pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result { .userid_lastonetimekeyupdate .watch_raw_prefix(&user_id) .boxed(), + // User account data + self.db + .roomuserdataid_accountdata + .watch_prefix(&roomuserdataid_prefix) + .boxed(), ]; let mut futures = FuturesUnordered::new();