Add issue label and milestone filters

This commit is contained in:
Georg Bauer
2026-07-31 13:42:06 +02:00
parent 6374636b04
commit 6eb27537e8
9 changed files with 492 additions and 18 deletions

View File

@@ -6,6 +6,10 @@ use security_framework::passwords::{get_generic_password, set_generic_password};
use crate::domain::{Preferences, Server, open_status};
pub fn favorite_key(server: &str, owner: &str, repository: &str) -> String {
repository_key(server, owner, repository)
}
pub fn repository_key(server: &str, owner: &str, repository: &str) -> String {
format!("{server}|{owner}/{repository}")
}
@@ -95,6 +99,19 @@ mod tests {
favorite_key("https://gitea.example.com", "octo", "demo"),
"https://gitea.example.com|octo/demo"
);
let preferences: Preferences = serde_json::from_str(
r#"{"issue_filters":{"server|octo/demo":{"milestone":"v1","labels":["bug"]}}}"#,
)
.unwrap();
assert_eq!(
preferences.issue_filters["server|octo/demo"].milestone,
"v1"
);
assert!(
preferences.issue_filters["server|octo/demo"]
.labels
.contains("bug")
);
assert_eq!(Preferences::default().pull_status, "open");
assert_eq!(
Preferences::default().appearance,