aboutsummaryrefslogtreecommitdiff
path: root/src/app/api_helpers.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-16 02:26:14 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-16 02:26:14 +0300
commit72770305d388fd5ec247493e05a89b686c6d0026 (patch)
tree44d95c9c69042ab07e27ace37853e190b6f00ba0 /src/app/api_helpers.rs
parent58c379f1f07adb4113e5f9ee673768b2e4b5be07 (diff)
feat: add hook-owned custom agent status labels
Diffstat (limited to 'src/app/api_helpers.rs')
-rw-r--r--src/app/api_helpers.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/api_helpers.rs b/src/app/api_helpers.rs
index 011e5ccb..56907ece 100644
--- a/src/app/api_helpers.rs
+++ b/src/app/api_helpers.rs
@@ -90,3 +90,12 @@ pub(super) fn normalize_reported_agent_label(agent: &str) -> Option<String> {
}
Some(trimmed.to_string())
}
+
+pub(super) fn normalize_custom_status(status: Option<String>) -> Option<String> {
+ let trimmed = status?.trim().to_string();
+ let mut normalized = String::new();
+ for ch in trimmed.chars().filter(|ch| !ch.is_control()).take(32) {
+ normalized.push(ch);
+ }
+ (!normalized.trim().is_empty()).then(|| normalized.trim().to_string())
+}