From d84957cc8c2aa3643bde572307667fbeb8de4e24 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 13 Apr 2025 19:02:00 -0700 Subject: [PATCH] web: use current thread, not first !seen in catchup mode --- web/src/state.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/src/state.rs b/web/src/state.rs index 9a337c0..55d07e3 100644 --- a/web/src/state.rs +++ b/web/src/state.rs @@ -616,9 +616,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { orders.send_msg(Msg::CatchupRequest { query }); } Msg::CatchupKeepUnread => { - if let Some(thread_id) = current_thread_id(&model.context) { - orders.send_msg(Msg::SetUnread(thread_id, true)); - }; orders.send_msg(Msg::CatchupNext); } Msg::CatchupMarkAsRead => { @@ -633,7 +630,15 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { orders.send_msg(Msg::GoToSearchResults); return; }; - let Some(idx) = catchup.items.iter().position(|i| !i.seen) else { + let Some(thread_id) = current_thread_id(&model.context) else { + return; + }; + let Some(idx) = catchup + .items + .iter() + .inspect(|i| info!("i {i:?} thread_id {thread_id}")) + .position(|i| i.id == thread_id) + else { // All items have been seen orders.send_msg(Msg::CatchupExit); orders.send_msg(Msg::GoToSearchResults); @@ -726,6 +731,7 @@ pub struct Catchup { pub items: Vec, } +#[derive(Debug)] pub struct CatchupItem { pub id: String, pub seen: bool,