mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
zerver: Remove now-unused report/ endpoints.
This commit is contained in:
committed by
Tim Abbott
parent
64b277d845
commit
1285c39098
@@ -1619,7 +1619,6 @@ class TestHumanUsersOnlyDecorator(ZulipTestCase):
|
|||||||
"/api/v1/users/me/hotspots",
|
"/api/v1/users/me/hotspots",
|
||||||
"/api/v1/users/me/presence",
|
"/api/v1/users/me/presence",
|
||||||
"/api/v1/users/me/tutorial_status",
|
"/api/v1/users/me/tutorial_status",
|
||||||
"/api/v1/report/send_times",
|
|
||||||
]
|
]
|
||||||
for endpoint in post_endpoints:
|
for endpoint in post_endpoints:
|
||||||
result = self.api_post(default_bot, endpoint)
|
result = self.api_post(default_bot, endpoint)
|
||||||
|
@@ -2,62 +2,6 @@ from zerver.lib.test_classes import ZulipTestCase
|
|||||||
|
|
||||||
|
|
||||||
class TestReport(ZulipTestCase):
|
class TestReport(ZulipTestCase):
|
||||||
def test_send_time(self) -> None:
|
|
||||||
self.login("hamlet")
|
|
||||||
|
|
||||||
params = dict(
|
|
||||||
time=5,
|
|
||||||
received=6,
|
|
||||||
displayed=7,
|
|
||||||
locally_echoed="true",
|
|
||||||
rendered_content_disparity="true",
|
|
||||||
)
|
|
||||||
|
|
||||||
result = self.client_post("/json/report/send_times", params)
|
|
||||||
self.assert_json_success(result)
|
|
||||||
|
|
||||||
def test_narrow_time(self) -> None:
|
|
||||||
self.login("hamlet")
|
|
||||||
|
|
||||||
params = dict(
|
|
||||||
initial_core=5,
|
|
||||||
initial_free=6,
|
|
||||||
network=7,
|
|
||||||
)
|
|
||||||
|
|
||||||
result = self.client_post("/json/report/narrow_times", params)
|
|
||||||
self.assert_json_success(result)
|
|
||||||
|
|
||||||
def test_anonymous_user_narrow_time(self) -> None:
|
|
||||||
params = dict(
|
|
||||||
initial_core=5,
|
|
||||||
initial_free=6,
|
|
||||||
network=7,
|
|
||||||
)
|
|
||||||
|
|
||||||
result = self.client_post("/json/report/narrow_times", params)
|
|
||||||
self.assert_json_success(result)
|
|
||||||
|
|
||||||
def test_unnarrow_time(self) -> None:
|
|
||||||
self.login("hamlet")
|
|
||||||
|
|
||||||
params = dict(
|
|
||||||
initial_core=5,
|
|
||||||
initial_free=6,
|
|
||||||
)
|
|
||||||
|
|
||||||
result = self.client_post("/json/report/unnarrow_times", params)
|
|
||||||
self.assert_json_success(result)
|
|
||||||
|
|
||||||
def test_anonymous_user_unnarrow_time(self) -> None:
|
|
||||||
params = dict(
|
|
||||||
initial_core=5,
|
|
||||||
initial_free=6,
|
|
||||||
)
|
|
||||||
|
|
||||||
result = self.client_post("/json/report/unnarrow_times", params)
|
|
||||||
self.assert_json_success(result)
|
|
||||||
|
|
||||||
def test_report_csp_violations(self) -> None:
|
def test_report_csp_violations(self) -> None:
|
||||||
fixture_data = self.fixture_data("csp_report.json")
|
fixture_data = self.fixture_data("csp_report.json")
|
||||||
with self.assertLogs(level="WARNING") as warn_logs:
|
with self.assertLogs(level="WARNING") as warn_logs:
|
||||||
|
@@ -1,77 +1,17 @@
|
|||||||
# System documented in https://zulip.readthedocs.io/en/latest/subsystems/logging.html
|
# System documented in https://zulip.readthedocs.io/en/latest/subsystems/logging.html
|
||||||
import logging
|
import logging
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from zerver.decorator import human_users_only
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.request import REQ, RequestNotes, has_request_variables
|
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.validator import (
|
from zerver.lib.validator import (
|
||||||
WildValue,
|
WildValue,
|
||||||
check_bool,
|
|
||||||
check_string,
|
check_string,
|
||||||
to_non_negative_int,
|
|
||||||
to_wild_value,
|
to_wild_value,
|
||||||
)
|
)
|
||||||
from zerver.models import UserProfile
|
|
||||||
|
|
||||||
|
|
||||||
@human_users_only
|
|
||||||
@has_request_variables
|
|
||||||
def report_send_times(
|
|
||||||
request: HttpRequest,
|
|
||||||
user_profile: UserProfile,
|
|
||||||
time: int = REQ(converter=to_non_negative_int),
|
|
||||||
received: int = REQ(converter=to_non_negative_int, default=-1),
|
|
||||||
displayed: int = REQ(converter=to_non_negative_int, default=-1),
|
|
||||||
locally_echoed: bool = REQ(json_validator=check_bool, default=False),
|
|
||||||
rendered_content_disparity: bool = REQ(json_validator=check_bool, default=False),
|
|
||||||
) -> HttpResponse:
|
|
||||||
received_str = "(unknown)"
|
|
||||||
if received > 0:
|
|
||||||
received_str = str(received)
|
|
||||||
displayed_str = "(unknown)"
|
|
||||||
if displayed > 0:
|
|
||||||
displayed_str = str(displayed)
|
|
||||||
|
|
||||||
log_data = RequestNotes.get_notes(request).log_data
|
|
||||||
assert log_data is not None
|
|
||||||
log_data[
|
|
||||||
"extra"
|
|
||||||
] = f"[{time}ms/{received_str}ms/{displayed_str}ms/echo:{locally_echoed}/diff:{rendered_content_disparity}]"
|
|
||||||
|
|
||||||
return json_success(request)
|
|
||||||
|
|
||||||
|
|
||||||
@has_request_variables
|
|
||||||
def report_narrow_times(
|
|
||||||
request: HttpRequest,
|
|
||||||
user_profile: Union[UserProfile, AnonymousUser],
|
|
||||||
initial_core: int = REQ(converter=to_non_negative_int),
|
|
||||||
initial_free: int = REQ(converter=to_non_negative_int),
|
|
||||||
network: int = REQ(converter=to_non_negative_int),
|
|
||||||
) -> HttpResponse:
|
|
||||||
log_data = RequestNotes.get_notes(request).log_data
|
|
||||||
assert log_data is not None
|
|
||||||
log_data["extra"] = f"[{initial_core}ms/{initial_free}ms/{network}ms]"
|
|
||||||
return json_success(request)
|
|
||||||
|
|
||||||
|
|
||||||
@has_request_variables
|
|
||||||
def report_unnarrow_times(
|
|
||||||
request: HttpRequest,
|
|
||||||
user_profile: Union[UserProfile, AnonymousUser],
|
|
||||||
initial_core: int = REQ(converter=to_non_negative_int),
|
|
||||||
initial_free: int = REQ(converter=to_non_negative_int),
|
|
||||||
) -> HttpResponse:
|
|
||||||
log_data = RequestNotes.get_notes(request).log_data
|
|
||||||
assert log_data is not None
|
|
||||||
log_data["extra"] = f"[{initial_core}ms/{initial_free}ms]"
|
|
||||||
return json_success(request)
|
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
|
@@ -132,9 +132,6 @@ from zerver.views.registration import (
|
|||||||
)
|
)
|
||||||
from zerver.views.report import (
|
from zerver.views.report import (
|
||||||
report_csp_violations,
|
report_csp_violations,
|
||||||
report_narrow_times,
|
|
||||||
report_send_times,
|
|
||||||
report_unnarrow_times,
|
|
||||||
)
|
)
|
||||||
from zerver.views.scheduled_messages import (
|
from zerver.views.scheduled_messages import (
|
||||||
delete_scheduled_messages,
|
delete_scheduled_messages,
|
||||||
@@ -493,20 +490,6 @@ v1_api_and_json_patterns = [
|
|||||||
rest_path("register", POST=(events_register_backend, {"allow_anonymous_user_web"})),
|
rest_path("register", POST=(events_register_backend, {"allow_anonymous_user_web"})),
|
||||||
# events -> zerver.tornado.views
|
# events -> zerver.tornado.views
|
||||||
rest_path("events", GET=get_events, DELETE=cleanup_event_queue),
|
rest_path("events", GET=get_events, DELETE=cleanup_event_queue),
|
||||||
# report -> zerver.views.report
|
|
||||||
#
|
|
||||||
# These endpoints are for internal error/performance reporting
|
|
||||||
# from the browser to the web app, and we don't expect to ever
|
|
||||||
# include in our API documentation.
|
|
||||||
rest_path("report/send_times", POST=(report_send_times, {"intentionally_undocumented"})),
|
|
||||||
rest_path(
|
|
||||||
"report/narrow_times",
|
|
||||||
POST=(report_narrow_times, {"allow_anonymous_user_web", "intentionally_undocumented"}),
|
|
||||||
),
|
|
||||||
rest_path(
|
|
||||||
"report/unnarrow_times",
|
|
||||||
POST=(report_unnarrow_times, {"allow_anonymous_user_web", "intentionally_undocumented"}),
|
|
||||||
),
|
|
||||||
# Used to generate a Zoom video call URL
|
# Used to generate a Zoom video call URL
|
||||||
rest_path("calls/zoom/create", POST=make_zoom_video_call),
|
rest_path("calls/zoom/create", POST=make_zoom_video_call),
|
||||||
# Used to generate a BigBlueButton video call URL
|
# Used to generate a BigBlueButton video call URL
|
||||||
|
Reference in New Issue
Block a user