mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 09:58:06 +00:00
zerver: Add endpoint to register a push device to server.
This commit adds an endpoint to register a push device to receive E2EE push notifications.
This commit is contained in:
committed by
Tim Abbott
parent
c846302417
commit
5f8edf669d
@@ -21,9 +21,11 @@ from zerver.actions.realm_settings import (
|
||||
)
|
||||
from zerver.lib import redis_utils
|
||||
from zerver.lib.exceptions import (
|
||||
InvalidBouncerPublicKeyError,
|
||||
JsonableError,
|
||||
MissingRemoteRealmError,
|
||||
RemoteRealmServerMismatchError,
|
||||
RequestExpiredError,
|
||||
)
|
||||
from zerver.lib.outgoing_http import OutgoingSession
|
||||
from zerver.lib.queue import queue_event_on_commit
|
||||
@@ -217,6 +219,12 @@ def send_to_push_bouncer(
|
||||
# The callers requesting this endpoint want the exception to propagate
|
||||
# so they can catch it.
|
||||
raise RemoteRealmServerMismatchError
|
||||
elif endpoint == "push/e2ee/register" and code == "INVALID_BOUNCER_PUBLIC_KEY":
|
||||
raise InvalidBouncerPublicKeyError
|
||||
elif endpoint == "push/e2ee/register" and code == "REQUEST_EXPIRED":
|
||||
raise RequestExpiredError
|
||||
elif endpoint == "push/e2ee/register" and code == "MISSING_REMOTE_REALM":
|
||||
raise MissingRemoteRealmError
|
||||
else:
|
||||
# But most other errors coming from the push bouncer
|
||||
# server are client errors (e.g. never-registered token)
|
||||
|
||||
Reference in New Issue
Block a user