web: when marking spam, also mark it as read

This commit is contained in:
Bill Thiede 2024-04-14 08:17:36 -07:00
parent a96b553b08
commit 48f66c7096
2 changed files with 12 additions and 5 deletions

View File

@ -443,6 +443,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
open_messages.insert(id); open_messages.insert(id);
} }
} }
Msg::MultiMsg(msgs) => msgs.into_iter().for_each(|msg| update(msg, model, orders)),
} }
} }
// `Model` describes our app state. // `Model` describes our app state.
@ -541,4 +542,5 @@ pub enum Msg {
MessageCollapse(String), MessageCollapse(String),
MessageExpand(String), MessageExpand(String),
MultiMsg(Vec<Msg>),
} }

View File

@ -341,7 +341,12 @@ fn search_toolbar(
attrs!{At::Title => "Mark as spam"}, attrs!{At::Title => "Mark as spam"},
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]], span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
IF!(show_icon_text=>span!["Spam"]), IF!(show_icon_text=>span!["Spam"]),
ev(Ev::Click, |_| Msg::SelectionAddTag("Spam".to_string())) ev(Ev::Click, |_|
Msg::MultiMsg(vec![
Msg::SelectionAddTag("Spam".to_string()),
Msg::SelectionMarkAsRead
])
)
], ],
], ],
] ]
@ -847,10 +852,10 @@ fn thread(
attrs! {At::Title => "Spam"}, attrs! {At::Title => "Spam"},
span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]], span![C!["icon", "is-small"], i![C!["far", "fa-hand"]]],
IF!(show_icon_text=>span!["Spam"]), IF!(show_icon_text=>span!["Spam"]),
ev(Ev::Click, move |_| Msg::AddTag( ev(Ev::Click, move |_| Msg::MultiMsg(vec![
format!("thread:{spam_thread_id}"), Msg::AddTag(format!("thread:{spam_thread_id}"), "Spam".to_string()),
"Spam".to_string() Msg::SetUnread(format!("thread:{spam_thread_id}"), true)
)), ])),
], ],
], ],
], ],