Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7528928

Browse files
committed
Ignore unknown conditions to fix unit tests
1 parent e58aa13 commit 7528928

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

rust/src/push/evaluator.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,8 @@ impl PushRuleEvaluator {
142142
) -> Result<bool, Error> {
143143
let known_condition = match condition {
144144
Condition::Known(known) => known,
145-
146-
// XXX This looks incorrect -- we have reached an unknown condition
147-
// kind and are unconditionally returning that it matches. Note that
148-
// it seems possible to provide a condition to the /pushrules
149-
// endpoint with an unknown kind, see
150-
// _rule_tuple_from_request_object.
151145
Condition::Unknown(_) => {
152-
return Ok(true);
146+
return Ok(false);
153147
}
154148
};
155149

tests/push/test_push_rule_evaluator.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,6 @@ def test_relation_match(self) -> None:
305305
evaluator = self._get_evaluator(
306306
{}, {"m.annotation": {("@user:test", "m.reaction")}}
307307
)
308-
condition = {"kind": "relation_match"}
309-
# Oddly, an unknown condition always matches.
310-
self.assertTrue(evaluator.matches(condition, "@user:test", "foo"))
311308

312309
# A push rule evaluator with the experimental rule enabled.
313310
evaluator = self._get_evaluator(

0 commit comments

Comments
 (0)