summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-11-02 13:44:12 +0000
committerErik Johnston <erik@matrix.org>2018-11-02 13:44:14 +0000
commitb86d05a279051b59d711c5a1982474994f302803 (patch)
tree9a3f3fe0da409a0181942a418e94efc2760bc397 /synapse/push
parentMerge pull request #4128 from matrix-org/erikj/state_res_v2_version (diff)
downloadsynapse-b86d05a279051b59d711c5a1982474994f302803.tar.xz
Clean up event accesses and tests
This is in preparation to refactor FrozenEvent to support different
event formats for different room versions
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/httppusher.py4
-rw-r--r--synapse/push/push_rule_evaluator.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py
index 6bd703632d..87fa7f006a 100644
--- a/synapse/push/httppusher.py
+++ b/synapse/push/httppusher.py
@@ -311,10 +311,10 @@ class HttpPusher(object):
                 ]
             }
         }
-        if event.type == 'm.room.member':
+        if event.type == 'm.room.member' and event.is_state():
             d['notification']['membership'] = event.content['membership']
             d['notification']['user_is_target'] = event.state_key == self.user_id
-        if self.hs.config.push_include_content and 'content' in event:
+        if self.hs.config.push_include_content and event.content:
             d['notification']['content'] = event.content
 
         # We no longer send aliases separately, instead, we send the human
diff --git a/synapse/push/push_rule_evaluator.py b/synapse/push/push_rule_evaluator.py
index 2bd321d530..cf6c8b875e 100644
--- a/synapse/push/push_rule_evaluator.py
+++ b/synapse/push/push_rule_evaluator.py
@@ -124,7 +124,7 @@ class PushRuleEvaluatorForEvent(object):
 
         # XXX: optimisation: cache our pattern regexps
         if condition['key'] == 'content.body':
-            body = self._event["content"].get("body", None)
+            body = self._event.content.get("body", None)
             if not body:
                 return False
 
@@ -140,7 +140,7 @@ class PushRuleEvaluatorForEvent(object):
         if not display_name:
             return False
 
-        body = self._event["content"].get("body", None)
+        body = self._event.content.get("body", None)
         if not body:
             return False