summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-09-18 15:39:39 +0100
committerDavid Baker <dave@matrix.org>2017-09-18 15:39:39 +0100
commita2562f9d749023b9564ccd36acf920eeb45178ff (patch)
tree33381eb6c3d25f56d94a7c21608900af1e861ec0
parentMerge pull request #2443 from matrix-org/erikj/rejoin_device_lists (diff)
downloadsynapse-a2562f9d749023b9564ccd36acf920eeb45178ff.tar.xz
Add support for event_id_only push format
Param in the data dict of a pusher that tells an HTTP pusher to
send just the event_id of the event it's notifying about and the
notification counts. For clients that want to go & fetch the body
of the event themselves anyway.
Diffstat (limited to '')
-rw-r--r--synapse/push/httppusher.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py
index 8a5d473108..1b6510eea4 100644
--- a/synapse/push/httppusher.py
+++ b/synapse/push/httppusher.py
@@ -244,6 +244,25 @@ class HttpPusher(object):
 
     @defer.inlineCallbacks
     def _build_notification_dict(self, event, tweaks, badge):
+        if 'format' in self.data and self.data['format'] == 'event_id_only':
+            d = {
+                'notification': {
+                    'event_id': event.event_id,
+                    'counts': {
+                        'unread': badge,
+                    },
+                    'devices': [
+                        {
+                            'app_id': self.app_id,
+                            'pushkey': self.pushkey,
+                            'pushkey_ts': long(self.pushkey_ts / 1000),
+                            'data': self.data_minus_url,
+                        }
+                    ]
+                }
+            }
+            defer.returnValue(d)
+
         ctx = yield push_tools.get_context_for_event(
             self.store, self.state_handler, event, self.user_id
         )