Add mark read/unread support for news

This commit is contained in:
2024-07-22 14:43:05 -07:00
parent 4ee34444ae
commit 831466ddda
5 changed files with 47 additions and 6 deletions

View File

@@ -272,11 +272,14 @@ impl Mutation {
unread: bool,
) -> Result<bool, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
info!("set_read_status({query}, {unread})");
if unread {
nm.tag_add("unread", &format!("{query}"))?;
} else {
nm.tag_remove("unread", &format!("{query}"))?;
let pool = ctx.data_unchecked::<PgPool>();
for q in query.split_whitespace() {
if newsreader::is_newsreader_thread(&q) {
newsreader::set_read_status(pool, &q, unread).await?;
} else {
nm::set_read_status(nm, q, unread).await?;
}
}
Ok(true)
}