Skip to content

Commit a91dc03

Browse files
handle empty filters
1 parent 586d81e commit a91dc03

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/alerts/alert_structs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,15 @@ impl Conditions {
216216
.map(Self::format_condition)
217217
.collect();
218218

219-
// Format nested groups recursively
219+
// Format nested groups recursively, skipping empty ones
220220
let group_parts: Vec<String> = self
221221
.groups
222222
.as_deref()
223223
.unwrap_or_default()
224224
.iter()
225-
.map(|g| format!("({})", g.generate_filter_message()))
225+
.map(|g| g.generate_filter_message())
226+
.filter(|msg| !msg.is_empty())
227+
.map(|msg| format!("({msg})"))
226228
.collect();
227229

228230
let all_parts: Vec<&str> = condition_parts

0 commit comments

Comments
 (0)