Compare commits

..

10 Commits

Author SHA1 Message Date
1bbebad01b chore: Release
All checks were successful
Continuous integration / Check (push) Successful in 41s
Continuous integration / Test Suite (push) Successful in 45s
Continuous integration / Rustfmt (push) Successful in 32s
Continuous integration / Trunk (push) Successful in 51s
Continuous integration / build (push) Successful in 53s
Continuous integration / Disallow unused dependencies (push) Successful in 2m5s
2025-04-22 22:28:20 -07:00
27edffd090 Set version for all packages 2025-04-22 22:28:03 -07:00
08212a9f78 chore: Release 2025-04-22 22:26:17 -07:00
877ec6c4b0 server: drop version requirement 2025-04-22 22:26:03 -07:00
3ce92d6bdf chore: Release 2025-04-22 22:24:37 -07:00
1a28bb2021 Use path for notmuch crate 2025-04-22 22:24:07 -07:00
b86f72f75c chore: Release 2025-04-22 22:20:00 -07:00
1a8b98d420 Use relative import for notmuch 2025-04-22 22:19:45 -07:00
383a7d800f chore: Release 2025-04-22 22:18:50 -07:00
453561140a server: batch tag changes and add default Grey tag 2025-04-22 22:18:24 -07:00
8 changed files with 96 additions and 40 deletions

33
Cargo.lock generated
View File

@ -3020,9 +3020,9 @@ dependencies = [
[[package]]
name = "letterbox-notmuch"
version = "0.17.3"
version = "0.17.9"
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
checksum = "660e35d98139603d764aba884faea20b6ebd43864afd8a70ee0864d161cb7089"
checksum = "aea61000b7ea6d2cca754dea71bafb54aa913a98f30f7b01836cce1414af5614"
dependencies = [
"log",
"mailparse",
@ -3034,7 +3034,7 @@ dependencies = [
[[package]]
name = "letterbox-notmuch"
version = "0.17.5"
version = "0.17.10"
dependencies = [
"itertools",
"log",
@ -3049,12 +3049,12 @@ dependencies = [
[[package]]
name = "letterbox-procmail2notmuch"
version = "0.17.5"
version = "0.17.10"
dependencies = [
"anyhow",
"clap",
"letterbox-notmuch 0.17.3",
"letterbox-shared 0.17.3",
"letterbox-notmuch 0.17.9",
"letterbox-shared 0.17.9",
"serde",
"sqlx",
"tokio 1.44.2",
@ -3062,7 +3062,7 @@ dependencies = [
[[package]]
name = "letterbox-server"
version = "0.17.5"
version = "0.17.10"
dependencies = [
"ammonia",
"anyhow",
@ -3080,8 +3080,8 @@ dependencies = [
"futures 0.3.31",
"headers",
"html-escape",
"letterbox-notmuch 0.17.3",
"letterbox-shared 0.17.3",
"letterbox-notmuch 0.17.10",
"letterbox-shared 0.17.10",
"linkify",
"log",
"lol_html",
@ -3106,12 +3106,12 @@ dependencies = [
[[package]]
name = "letterbox-shared"
version = "0.17.3"
version = "0.17.9"
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
checksum = "e30cefa3eebb0b15b077527072a4a53dbde8dd6cb513b20e78f036a84c86329a"
checksum = "359b4c3ab6b8a91d9a66798b3ee87285f102b7820d38f1d5d3f4be4ea7480803"
dependencies = [
"build-info",
"letterbox-notmuch 0.17.3",
"letterbox-notmuch 0.17.9",
"regex",
"serde",
"sqlx",
@ -3121,10 +3121,10 @@ dependencies = [
[[package]]
name = "letterbox-shared"
version = "0.17.5"
version = "0.17.10"
dependencies = [
"build-info",
"letterbox-notmuch 0.17.3",
"letterbox-notmuch 0.17.10",
"regex",
"serde",
"sqlx",
@ -3134,7 +3134,7 @@ dependencies = [
[[package]]
name = "letterbox-web"
version = "0.17.5"
version = "0.17.10"
dependencies = [
"build-info",
"build-info-build",
@ -3146,8 +3146,7 @@ dependencies = [
"graphql_client",
"human_format",
"itertools",
"letterbox-notmuch 0.17.3",
"letterbox-shared 0.17.3",
"letterbox-shared 0.17.9",
"log",
"seed",
"seed_hooks",

View File

@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
edition = "2021"
license = "UNLICENSED"
publish = ["xinu"]
version = "0.17.5"
version = "0.17.10"
repository = "https://git.z.xinu.tv/wathiede/letterbox"
[profile.dev]

View File

@ -503,15 +503,28 @@ impl Notmuch {
self.tags_for_query("*")
}
#[instrument(skip_all, fields(tag=tag,search_term=search_term))]
pub fn tag_add(&self, tag: &str, search_term: &str) -> Result<(), NotmuchError> {
self.run_notmuch(["tag", &format!("+{tag}"), search_term])?;
self.tags_add(tag, &[search_term])
}
#[instrument(skip_all, fields(tag=tag,search_term=?search_term))]
pub fn tags_add(&self, tag: &str, search_term: &[&str]) -> Result<(), NotmuchError> {
let tag = format!("+{tag}");
let mut args = vec!["tag", &tag];
args.extend(search_term);
self.run_notmuch(&args)?;
Ok(())
}
#[instrument(skip_all, fields(tag=tag,search_term=search_term))]
pub fn tag_remove(&self, tag: &str, search_term: &str) -> Result<(), NotmuchError> {
self.run_notmuch(["tag", &format!("-{tag}"), search_term])?;
self.tags_remove(tag, &[search_term])
}
#[instrument(skip_all, fields(tag=tag,search_term=?search_term))]
pub fn tags_remove(&self, tag: &str, search_term: &[&str]) -> Result<(), NotmuchError> {
let tag = format!("-{tag}");
let mut args = vec!["tag", &tag];
args.extend(search_term);
self.run_notmuch(&args)?;
Ok(())
}

View File

@ -13,8 +13,8 @@ version.workspace = true
[dependencies]
anyhow = "1.0.98"
clap = { version = "4.5.37", features = ["derive", "env"] }
letterbox-notmuch = { version = "0.17.2", registry = "xinu" }
letterbox-shared = { version = "0.17.2", registry = "xinu" }
letterbox-notmuch = { version = "0.17.9", registry = "xinu" }
letterbox-shared = { version = "0.17.9", registry = "xinu" }
serde = { version = "1.0.219", features = ["derive"] }
sqlx = { version = "0.8.5", features = ["postgres", "runtime-tokio"] }
tokio = { version = "1.44.2", features = ["rt", "macros", "rt-multi-thread"] }

View File

@ -27,8 +27,8 @@ css-inline = "0.14.4"
futures = "0.3.31"
headers = "0.4.0"
html-escape = "0.2.13"
letterbox-notmuch = { version = "0.17.2", registry = "xinu" }
letterbox-shared = { version = "0.17.2", registry = "xinu" }
letterbox-notmuch = { path = "../notmuch", version = "0.17.10", registry = "xinu" }
letterbox-shared = { path = "../shared", version = "0.17.10", registry = "xinu" }
linkify = "0.10.0"
log = "0.4.27"
lol_html = "2.3.0"

View File

@ -982,6 +982,8 @@ pub async fn label_unprocessed(
} else {
&ids[..]
};
let mut add_mutations = HashMap::new();
let mut rm_mutations = HashMap::new();
for id in ids {
let id = format!("id:{id}");
let files = nm.files(&id)?;
@ -1001,20 +1003,63 @@ pub async fn label_unprocessed(
.get_first_value("subject")
.expect("no subject header")
);
} else {
}
for t in &add_tags {
nm.tag_add(t, &id)?;
//nm.tag_add(t, &id)?;
add_mutations
.entry(t.to_string())
.or_insert_with(|| Vec::new())
.push(id.clone());
}
if add_tags.contains("spam") || add_tags.contains("Spam") {
nm.tag_remove("unread", &id)?;
//nm.tag_remove("unread", &id)?;
let t = "unread".to_string();
rm_mutations
.entry(t)
.or_insert_with(|| Vec::new())
.push(id.clone());
}
if !add_tags.contains("inbox") {
nm.tag_remove("inbox", &id)?;
//nm.tag_remove("inbox", &id)?;
let t = "inbox".to_string();
rm_mutations
.entry(t)
.or_insert_with(|| Vec::new())
.push(id.clone());
}
nm.tag_remove("unprocessed", &id)?;
//nm.tag_remove("unprocessed", &id)?;
let t = "unprocessed".to_string();
rm_mutations
.entry(t)
.or_insert_with(|| Vec::new())
.push(id.clone());
} else {
if add_tags.is_empty() {
let t = "Grey".to_string();
add_mutations
.entry(t)
.or_insert_with(|| Vec::new())
.push(id.clone());
}
}
}
println!("Adding {} distinct labels", add_mutations.len());
for (tag, ids) in add_mutations.iter() {
println!(" {tag}: {}", ids.len());
if !dryrun {
let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect();
nm.tags_add(tag, &ids)?;
}
}
println!("Removing {} distinct labels", rm_mutations.len());
for (tag, ids) in rm_mutations.iter() {
println!(" {tag}: {}", ids.len());
if !dryrun {
let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect();
nm.tags_remove(tag, &ids)?;
}
}
Ok(())
}
fn find_tags<'a, 'b>(rules: &'a [Rule], headers: &'b [MailHeader]) -> (bool, HashSet<&'a str>) {

View File

@ -12,7 +12,7 @@ version.workspace = true
[dependencies]
build-info = "0.0.40"
letterbox-notmuch = { version = "0.17.2", registry = "xinu" }
letterbox-notmuch = { path = "../notmuch", version = "0.17.10", registry = "xinu" }
regex = "1.11.1"
serde = { version = "1.0.219", features = ["derive"] }
sqlx = "0.8.5"

View File

@ -33,8 +33,7 @@ wasm-bindgen = "=0.2.100"
uuid = { version = "1.16.0", features = [
"js",
] } # direct dep to set js feature, prevents Rng issues
letterbox-shared = { version = "0.17.2", registry = "xinu" }
letterbox-notmuch = { version = "0.17.2", registry = "xinu" }
letterbox-shared = { version = "0.17.9", registry = "xinu" }
seed_hooks = { version = "0.4.1", registry = "xinu" }
strum_macros = "0.27.1"
gloo-console = "0.3.0"