Allow multiple pushers for a single app ID & pushkey, honouring the 'append' flag in the API.

This commit is contained in:
David Baker 2015-03-25 19:06:22 +00:00
parent ce2766d19c
commit c1a256cc4c
5 changed files with 96 additions and 28 deletions

View file

@ -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(),