decorator: Rename internal_notify_view.

As noted in the previous commit, this decorator is not just used for
"notify" endpoints anymore.
This commit is contained in:
Alex Vandiver
2024-02-08 19:40:39 +00:00
committed by Tim Abbott
parent be75736a95
commit ab683fac29
4 changed files with 8 additions and 8 deletions

View File

@@ -927,7 +927,7 @@ def authenticate_internal_api(request: HttpRequest, secret: str = REQ("secret"))
)
def internal_notify_view(
def internal_api_view(
is_tornado_view: bool,
) -> Callable[
[Callable[Concatenate[HttpRequest, ParamT], HttpResponse]],

View File

@@ -23,7 +23,7 @@ from zerver.decorator import (
authenticated_json_view,
authenticated_rest_api_view,
authenticated_uploads_api_view,
internal_notify_view,
internal_api_view,
process_client,
public_json_view,
return_success_on_head_request,
@@ -995,7 +995,7 @@ class TestInternalNotifyView(ZulipTestCase):
def internal_notify(self, is_tornado: bool, req: HttpRequest) -> HttpResponse:
boring_view = lambda req: json_response(msg=self.BORING_RESULT)
return internal_notify_view(is_tornado)(boring_view)(req)
return internal_api_view(is_tornado)(boring_view)(req)
def test_valid_internal_requests(self) -> None:
secret = "random"

View File

@@ -7,7 +7,7 @@ from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from typing_extensions import ParamSpec
from zerver.decorator import internal_notify_view, process_client
from zerver.decorator import internal_api_view, process_client
from zerver.lib.exceptions import JsonableError
from zerver.lib.queue import get_queue_client
from zerver.lib.request import REQ, RequestNotes, has_request_variables
@@ -38,7 +38,7 @@ def in_tornado_thread(f: Callable[P, T]) -> Callable[P, T]:
return async_to_sync(wrapped)
@internal_notify_view(True)
@internal_api_view(True)
@has_request_variables
def notify(
request: HttpRequest, data: Mapping[str, Any] = REQ(json_validator=check_dict([]))
@@ -79,7 +79,7 @@ def cleanup_event_queue(
return json_success(request)
@internal_notify_view(True)
@internal_api_view(True)
@has_request_variables
def get_events_internal(
request: HttpRequest, user_profile_id: int = REQ(json_validator=check_int)

View File

@@ -1,13 +1,13 @@
from django.http import HttpRequest, HttpResponse
from zerver.decorator import internal_notify_view
from zerver.decorator import internal_api_view
from zerver.lib.email_mirror import mirror_email_message
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
@internal_notify_view(False)
@internal_api_view(False)
@has_request_variables
def email_mirror_message(
request: HttpRequest,