mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Need to use re.search if looking for matches not at the start of the string. Also comparisons with None should be 'is'.
This commit is contained in:
parent
0b725f5c4f
commit
8f616684a3
@ -154,7 +154,7 @@ class Pusher(object):
|
||||
val = _value_for_dotted_key(condition['key'], ev)
|
||||
if val is None:
|
||||
return False
|
||||
return re.match(r, val, flags=re.IGNORECASE) != None
|
||||
return re.search(r, val, flags=re.IGNORECASE) is not None
|
||||
|
||||
elif condition['kind'] == 'device':
|
||||
if 'profile_tag' not in condition:
|
||||
@ -170,8 +170,8 @@ class Pusher(object):
|
||||
return False
|
||||
if not display_name:
|
||||
return False
|
||||
return re.match("\b%s\b" % re.escape(display_name),
|
||||
ev['content']['body'], flags=re.IGNORECASE) != None
|
||||
return re.search("\b%s\b" % re.escape(display_name),
|
||||
ev['content']['body'], flags=re.IGNORECASE) is not None
|
||||
|
||||
elif condition['kind'] == 'room_member_count':
|
||||
if 'is' not in condition:
|
||||
|
Loading…
Reference in New Issue
Block a user