web: use current thread, not first !seen in catchup mode

This commit is contained in:
Bill Thiede 2025-04-13 19:02:00 -07:00
parent d53db5b49a
commit d84957cc8c

View File

@ -616,9 +616,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
orders.send_msg(Msg::CatchupRequest { query }); orders.send_msg(Msg::CatchupRequest { query });
} }
Msg::CatchupKeepUnread => { 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); orders.send_msg(Msg::CatchupNext);
} }
Msg::CatchupMarkAsRead => { Msg::CatchupMarkAsRead => {
@ -633,7 +630,15 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
orders.send_msg(Msg::GoToSearchResults); orders.send_msg(Msg::GoToSearchResults);
return; 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 // All items have been seen
orders.send_msg(Msg::CatchupExit); orders.send_msg(Msg::CatchupExit);
orders.send_msg(Msg::GoToSearchResults); orders.send_msg(Msg::GoToSearchResults);
@ -726,6 +731,7 @@ pub struct Catchup {
pub items: Vec<CatchupItem>, pub items: Vec<CatchupItem>,
} }
#[derive(Debug)]
pub struct CatchupItem { pub struct CatchupItem {
pub id: String, pub id: String,
pub seen: bool, pub seen: bool,