Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
request-notes: Add `is_webhook_view` boolean to fields.
Lauryn Menardb8197e06bce8
diff --git a/zerver/decorator.py b/zerver/decorator.pyindex 7e633f85193..d76e9e4953c 100644--- a/zerver/decorator.py+++ b/zerver/decorator.py@@ -347,6 +347,9 @@ def webhook_view(client_name=full_webhook_client_name(webhook_client_name),)+ request_notes = RequestNotes.get_notes(request)+ request_notes.is_webhook_view = True+rate_limit_user(request, user_profile, domain="api_by_user")try:return view_func(request, user_profile, *args, **kwargs)@@ -751,6 +754,11 @@ def authenticated_rest_api_view(allow_webhook_access=allow_webhook_access,client_name=full_webhook_client_name(webhook_client_name),)++ if webhook_client_name is not None:+ request_notes = RequestNotes.get_notes(request)+ request_notes.is_webhook_view = True+except JsonableError as e:raise UnauthorizedError(e.msg)try:diff --git a/zerver/lib/request.py b/zerver/lib/request.pyindex 7f47e4b717d..bb97a727e38 100644--- a/zerver/lib/request.py+++ b/zerver/lib/request.py@@ -72,6 +72,7 @@ class RequestNotes(BaseNotes[HttpRequest, "RequestNotes"]):processed_parameters: Set[str] = field(default_factory=set)ignored_parameters: Set[str] = field(default_factory=set)remote_server: Optional["RemoteZulipServer"] = None+ is_webhook_view: bool = False@classmethoddef init_notes(cls) -> "RequestNotes":