Commit 8a94921c88

8a94921c88fc145c8bca612afbb2d6a19be43347

parent: 1dfdbb7098

Unregistered key

vaw <git@nlih.de> · 2026-11-11 20:55 UTC

Small fixes

Layout: unified · split

src/base.rs +2 −2
@@ -1400,7 +1400,6 @@ pub struct Thread {
1400 messages: Messages, 1400 messages: Messages,
1401 1401
1402 root: Option<Message>, 1402 root: Option<Message>,
1403 // TODO: check access
1404 pub(crate) summary: Option<ThreadSummary>, 1403 pub(crate) summary: Option<ThreadSummary>,
1405 1404
1406 pub(crate) unreads: ReadReceipts, 1405 pub(crate) unreads: ReadReceipts,
@@ -1435,7 +1434,7 @@ impl Thread {
1435 root: &EventId, 1434 root: &EventId,
1436 store: &AsyncProgramStore, 1435 store: &AsyncProgramStore,
1437 ) { 1436 ) {
1438 if self.update_handle.is_some() { 1437 if self.update_handle.as_ref().is_some_and(|handle| !handle.is_finished()) {
1439 return; 1438 return;
1440 } 1439 }
1441 1440
@@ -1689,6 +1688,7 @@ impl RoomInfo {
1689 } 1688 }
1690 } 1689 }
1691 1690
1691 /// Spawn subscriber tasks for all thread updates.
1692 pub(crate) async fn subscribe_thread_updates( 1692 pub(crate) async fn subscribe_thread_updates(
1693 &mut self, 1693 &mut self,
1694 room: &MatrixRoom, 1694 room: &MatrixRoom,
src/message/mod.rs +3 −6
@@ -1027,12 +1027,9 @@ impl<'a> MessageFormatter<'a> {
1027 1027
1028 if num > 0 { 1028 if num > 0 {
1029 threaded.push_str(" (", style); 1029 threaded.push_str(" (", style);
1030 threaded.push_span_nobreak(Span::styled( 1030 threaded.push_span_nobreak(Span::styled(num.to_string(), style.bold()));
1031 thread.unreads.num_mentions.to_string(),
1032 style.bold(),
1033 ));
1034 threaded.push_str(" ", style); 1031 threaded.push_str(" ", style);
1035 if is_plural { 1032 if num > 1 {
1036 threaded.push_str(plural, style); 1033 threaded.push_str(plural, style);
1037 } else { 1034 } else {
1038 threaded.push_str(singular, style); 1035 threaded.push_str(singular, style);
@@ -1183,7 +1180,7 @@ impl Message {
1183 } 1180 }
1184 1181
1185 /// The read receipt thread that this message was inserted into. 1182 /// The read receipt thread that this message was inserted into.
1186 fn receipt_thread(&self, info: &RoomInfo) -> ReceiptThread { 1183 pub(crate) fn receipt_thread(&self, info: &RoomInfo) -> ReceiptThread {
1187 self.event 1184 self.event
1188 .event_id() 1185 .event_id()
1189 .and_then(|event_id| info.get_receipt_thread(event_id)) 1186 .and_then(|event_id| info.get_receipt_thread(event_id))
src/windows/room/message.rs +1 −5
@@ -380,12 +380,8 @@ impl StatefulWidget for MessageWidget<'_> {
380 // receipts 380 // receipts
381 if saved_tunables.read_receipt_display && 381 if saved_tunables.read_receipt_display &&
382 let Some(event_id) = msg.event.event_id() && 382 let Some(event_id) = msg.event.event_id() &&
383 let Some((thread, _)) = info.get_message_location(event_id) 383 let Some(thread) = info.get_receipt_thread(event_id)
384 { 384 {
385 let thread = match thread {
386 Some(root) => ReceiptThread::Thread(root.to_owned()),
387 None => ReceiptThread::Main,
388 };
389 let receipts = info 385 let receipts = info
390 .event_receipts(&thread) 386 .event_receipts(&thread)
391 .into_iter() 387 .into_iter()
src/worker.rs +10 −9
@@ -762,6 +762,7 @@ pub(crate) async fn subscribe_thread_updates(
762 Ok(tokio::spawn(async move { 762 Ok(tokio::spawn(async move {
763 let _drop_handle = drop_handle; 763 let _drop_handle = drop_handle;
764 764
765 // Insert the initial events
765 { 766 {
766 let msgs = get_receipts_for_timeline_events(&room, initial_events).await; 767 let msgs = get_receipts_for_timeline_events(&room, initial_events).await;
767 let mut locked = store.lock().await; 768 let mut locked = store.lock().await;
@@ -789,13 +790,13 @@ pub(crate) async fn subscribe_thread_updates(
789 return 790 return
790 }; 791 };
791 792
792 store 793 store
793 .lock() 794 .lock()
794 .await 795 .await
795 .application 796 .application
796 .get_room_info(room.room_id().to_owned()) 797 .get_room_info(room.room_id().to_owned())
797 .get_thread_mut(thread_id.clone()) 798 .get_thread_mut(thread_id.clone())
798 .unreads = update.read_receipts; 799 .unreads = update.read_receipts;
799 } 800 }
800 } 801 }
801 } 802 }
@@ -809,8 +810,8 @@ async fn handle_thread_update(
809) { 810) {
810 match update { 811 match update {
811 ThreadEventCacheUpdate::UpdateTimelineEvents(diffs) => { 812 ThreadEventCacheUpdate::UpdateTimelineEvents(diffs) => {
812 // Ignore the update itself and just collect the changed items. Because we index by 813 // Ignore the update itself and just collect the changed items.
813 // `MessageKey`, the correct events should be replaced. 814 // The updated events will be replaced because we index by `MessageKey`.
814 let events = diffs 815 let events = diffs
815 .diffs 816 .diffs
816 .into_iter() 817 .into_iter()