web: add per-message unread control and display
This commit is contained in:
@@ -217,6 +217,25 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
orders.request_url(urls::search(&query, 0));
|
||||
}
|
||||
|
||||
Msg::SetUnread(query, unread) => {
|
||||
orders.skip().perform_cmd(async move {
|
||||
let res: Result<
|
||||
graphql_client::Response<graphql::mark_read_mutation::ResponseData>,
|
||||
gloo_net::Error,
|
||||
> = send_graphql(graphql::MarkReadMutation::build_query(
|
||||
graphql::mark_read_mutation::Variables {
|
||||
query: query.clone(),
|
||||
unread,
|
||||
},
|
||||
))
|
||||
.await;
|
||||
if let Err(e) = res {
|
||||
error!("Failed to set read for {query} to {unread}: {e}");
|
||||
}
|
||||
Msg::RefreshStart
|
||||
});
|
||||
}
|
||||
|
||||
Msg::FrontPageRequest {
|
||||
query,
|
||||
after,
|
||||
@@ -380,6 +399,8 @@ pub enum Msg {
|
||||
UpdateQuery(String),
|
||||
SearchQuery(String),
|
||||
|
||||
SetUnread(String, bool),
|
||||
|
||||
FrontPageRequest {
|
||||
query: String,
|
||||
after: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user