From f9b9112d07426710c67c69f6919f2a1ef2c3aad9 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 17 Feb 2022 10:09:21 +0100 Subject: [PATCH] common: Disable push rule matching on numbers or booleans Spec clarification: https://github.com/matrix-org/matrix-doc/pull/3690 --- crates/ruma-common/src/push/condition.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/crates/ruma-common/src/push/condition.rs b/crates/ruma-common/src/push/condition.rs index 4ac5156d..211868c2 100644 --- a/crates/ruma-common/src/push/condition.rs +++ b/crates/ruma-common/src/push/condition.rs @@ -291,12 +291,7 @@ impl FlattenedJson { warn!("Duplicate path in flattened JSON: {}", path); } } - JsonValue::Number(_) | JsonValue::Bool(_) => { - if self.map.insert(path.clone(), value.to_string()).is_some() { - warn!("Duplicate path in flattened JSON: {}", path); - } - } - JsonValue::Array(_) | JsonValue::Null => {} + JsonValue::Number(_) | JsonValue::Bool(_) | JsonValue::Array(_) | JsonValue::Null => {} } } @@ -572,14 +567,7 @@ mod tests { .unwrap(); let flattened = FlattenedJson::from_raw(&raw); - assert_eq!( - flattened.map, - btreemap! { - "string".into() => "Hello World".into(), - "number".into() => "10".into(), - "boolean".into() => "true".into(), - }, - ); + assert_eq!(flattened.map, btreemap! { "string".into() => "Hello World".into() }); } #[test]