web: refactor mark read logic to be two phases
This commit is contained in:
@@ -760,14 +760,20 @@ fn thread(
|
||||
attrs! {At::Title => "Mark as read"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
|
||||
IF!(show_icon_text=>span!["Read"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(read_thread_id, false)),
|
||||
ev(Ev::Click, move |_| Msg::MultiMsg(vec![
|
||||
Msg::SetUnread(read_thread_id, false),
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
],
|
||||
button![
|
||||
C!["button", "mark-unread"],
|
||||
attrs! {At::Title => "Mark as unread"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
|
||||
IF!(show_icon_text=>span!["Unread"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(unread_thread_id, true)),
|
||||
ev(Ev::Click, move |_| Msg::MultiMsg(vec![
|
||||
Msg::SetUnread(unread_thread_id, true),
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -782,7 +788,8 @@ fn thread(
|
||||
IF!(show_icon_text=>span!["Spam"]),
|
||||
ev(Ev::Click, move |_| Msg::MultiMsg(vec![
|
||||
Msg::AddTag(spam_add_thread_id, "Spam".to_string()),
|
||||
Msg::SetUnread(spam_unread_thread_id, false)
|
||||
Msg::SetUnread(spam_unread_thread_id, false),
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
],
|
||||
],
|
||||
@@ -1060,14 +1067,20 @@ fn news_post(
|
||||
attrs! {At::Title => "Mark as read"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope-open"]]],
|
||||
IF!(show_icon_text=>span!["Read"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(read_thread_id, false)),
|
||||
ev(Ev::Click, move |_| Msg::MultiMsg(vec![
|
||||
Msg::SetUnread(read_thread_id, false),
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
],
|
||||
button![
|
||||
C!["button", "mark-unread"],
|
||||
attrs! {At::Title => "Mark as unread"},
|
||||
span![C!["icon", "is-small"], i![C!["far", "fa-envelope"]]],
|
||||
IF!(show_icon_text=>span!["Unread"]),
|
||||
ev(Ev::Click, move |_| Msg::SetUnread(unread_thread_id, true)),
|
||||
ev(Ev::Click, move |_| Msg::MultiMsg(vec![
|
||||
Msg::SetUnread(unread_thread_id, true),
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -1096,12 +1109,8 @@ fn news_post(
|
||||
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
|
||||
let from = &post.site;
|
||||
// TODO: move avatar/favicon stuff to the server side and and come up with a solution for emails
|
||||
let avatar: Option<String> = None;
|
||||
//let avatar: Option<String> = Some(String::from("https://bulma.io/images/placeholders/64x64.png"));
|
||||
let id = post.thread_id.clone();
|
||||
let is_unread = !post.is_read;
|
||||
// TODO: use https://www.google.com/s2/favicons?domain={domain}
|
||||
let avatar = render_avatar(avatar, &from, true);
|
||||
let url = &post.url;
|
||||
let idx = url
|
||||
.match_indices('/')
|
||||
|
||||
Reference in New Issue
Block a user