Fix most incorrect unreads on startup (#433)

This commit is contained in:
VAWVAW 2025-05-30 15:56:46 +00:00 committed by GitHub
parent 98aa2f871d
commit f39261ff84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -302,7 +302,7 @@ async fn load_older_one(
let event_id = msg.event_id(); let event_id = msg.event_id();
let receipts = match room let receipts = match room
.load_event_receipts(ReceiptType::Read, ReceiptThread::Main, event_id) .load_event_receipts(ReceiptType::Read, ReceiptThread::Unthreaded, event_id)
.await .await
{ {
Ok(receipts) => receipts.into_iter().map(|(u, _)| u).collect(), Ok(receipts) => receipts.into_iter().map(|(u, _)| u).collect(),
@ -1044,7 +1044,10 @@ impl ClientWorker {
let Some(receipts) = receipts.get(&ReceiptType::Read) else { let Some(receipts) = receipts.get(&ReceiptType::Read) else {
continue; continue;
}; };
for user_id in receipts.keys() { for (user_id, _) in receipts
.iter()
.filter(|(_, rcpt)| rcpt.thread == ReceiptThread::Unthreaded)
{
info.set_receipt(user_id.to_owned(), event_id.clone()); info.set_receipt(user_id.to_owned(), event_id.clone());
} }
} }