summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-03-25 19:06:22 +0000
committerDavid Baker <dave@matrix.org>2015-03-25 19:06:22 +0000
commitc1a256cc4c82ce746eae8e719b9aa2344fe66177 (patch)
treef2595a72adbef12770114e71dc58e2d6ab03c0ef /synapse/rest
parentFix tests (diff)
downloadsynapse-c1a256cc4c82ce746eae8e719b9aa2344fe66177.tar.xz
Allow multiple pushers for a single app ID & pushkey, honouring the 'append' flag in the API.
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/pusher.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/pusher.py b/synapse/rest/client/v1/pusher.py
index 87e89c9305..c83287c028 100644
--- a/synapse/rest/client/v1/pusher.py
+++ b/synapse/rest/client/v1/pusher.py
@@ -37,7 +37,7 @@ class PusherRestServlet(ClientV1RestServlet):
                 and 'kind' in content and
                 content['kind'] is None):
             yield pusher_pool.remove_pusher(
-                content['app_id'], content['pushkey']
+                content['app_id'], content['pushkey'], user_name=user.to_string()
             )
             defer.returnValue((200, {}))
 
@@ -51,6 +51,17 @@ class PusherRestServlet(ClientV1RestServlet):
             raise SynapseError(400, "Missing parameters: "+','.join(missing),
                                errcode=Codes.MISSING_PARAM)
 
+        append = False
+        if 'append' in content:
+            append = content['append']
+
+        if not append:
+            yield pusher_pool.remove_pushers_by_app_id_and_pushkey_not_user(
+                app_id=content['app_id'],
+                pushkey=content['pushkey'],
+                not_user_id=user.to_string()
+            )
+
         try:
             yield pusher_pool.add_pusher(
                 user_name=user.to_string(),