Add an additional HTTP pusher + push rule tests. (#12188)

And rename the field used for caching from _id to _cache_key.
This commit is contained in:
Nick Mills-Barrett 2022-03-11 14:45:26 +01:00 committed by GitHub
parent 003cc6910a
commit 735e89bd3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 28 deletions

View file

@ -274,17 +274,17 @@ def _condition_checker(
cache: Dict[str, bool],
) -> bool:
for cond in conditions:
_id = cond.get("_id", None)
if _id:
res = cache.get(_id, None)
_cache_key = cond.get("_cache_key", None)
if _cache_key:
res = cache.get(_cache_key, None)
if res is False:
return False
elif res is True:
continue
res = evaluator.matches(cond, uid, display_name)
if _id:
cache[_id] = bool(res)
if _cache_key:
cache[_cache_key] = bool(res)
if not res:
return False