diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-10-19 09:12:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 09:12:39 -0400 |
commit | c356b4bf422430cd5769c9bf90756fca2efd8451 (patch) | |
tree | 73e1fd92e068839a12839b9a214df05adbf02c7c /synapse/push | |
parent | Support running synmark on macOS. (#8578) (diff) | |
download | synapse-c356b4bf422430cd5769c9bf90756fca2efd8451.tar.xz |
Include a simple message in email notifications that include encrypted content (#8545)
Diffstat (limited to 'synapse/push')
-rw-r--r-- | synapse/push/mailer.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py index 455a1acb46..155791b754 100644 --- a/synapse/push/mailer.py +++ b/synapse/push/mailer.py @@ -387,8 +387,8 @@ class Mailer: return ret async def get_message_vars(self, notif, event, room_state_ids): - if event.type != EventTypes.Message: - return + if event.type != EventTypes.Message and event.type != EventTypes.Encrypted: + return None sender_state_event_id = room_state_ids[("m.room.member", event.sender)] sender_state_event = await self.store.get_event(sender_state_event_id) @@ -399,10 +399,8 @@ class Mailer: # sender_hash % the number of default images to choose from sender_hash = string_ordinal_total(event.sender) - msgtype = event.content.get("msgtype") - ret = { - "msgtype": msgtype, + "event_type": event.type, "is_historical": event.event_id != notif["event_id"], "id": event.event_id, "ts": event.origin_server_ts, @@ -411,6 +409,14 @@ class Mailer: "sender_hash": sender_hash, } + # Encrypted messages don't have any additional useful information. + if event.type == EventTypes.Encrypted: + return ret + + msgtype = event.content.get("msgtype") + + ret["msgtype"] = msgtype + if msgtype == "m.text": self.add_text_message_vars(ret, event) elif msgtype == "m.image": |