Commit f39261ff84

f39261ff84678feae1e58a5e050fbe4bd4ae27b5

parent: 98aa2f871d

Unregistered key

VAWVAW <94846592+VAWVAW@users.noreply.github.com> · 2025-05-30 15:56 UTC
committer: <noreply@github.com>

Fix most incorrect unreads on startup (#433)

Layout: unified · split

src/worker.rs +5 −2
@@ -302,7 +302,7 @@ async fn load_older_one(
302 302
303 let event_id = msg.event_id(); 303 let event_id = msg.event_id();
304 let receipts = match room 304 let receipts = match room
305 .load_event_receipts(ReceiptType::Read, ReceiptThread::Main, event_id) 305 .load_event_receipts(ReceiptType::Read, ReceiptThread::Unthreaded, event_id)
306 .await 306 .await
307 { 307 {
308 Ok(receipts) => receipts.into_iter().map(|(u, _)| u).collect(), 308 Ok(receipts) => receipts.into_iter().map(|(u, _)| u).collect(),
@@ -1044,7 +1044,10 @@ impl ClientWorker {
1044 let Some(receipts) = receipts.get(&ReceiptType::Read) else { 1044 let Some(receipts) = receipts.get(&ReceiptType::Read) else {
1045 continue; 1045 continue;
1046 }; 1046 };
1047 for user_id in receipts.keys() { 1047 for (user_id, _) in receipts
1048 .iter()
1049 .filter(|(_, rcpt)| rcpt.thread == ReceiptThread::Unthreaded)
1050 {
1048 info.set_receipt(user_id.to_owned(), event_id.clone()); 1051 info.set_receipt(user_id.to_owned(), event_id.clone());
1049 } 1052 }
1050 } 1053 }