diff --git a/zerver/tests/test_report.py b/zerver/tests/test_report.py index 93c2acfa90..4de315ff94 100644 --- a/zerver/tests/test_report.py +++ b/zerver/tests/test_report.py @@ -4,6 +4,7 @@ from __future__ import print_function from typing import Any, Callable, Iterable, Tuple +from django.test import override_settings from zerver.lib.test_classes import ( ZulipTestCase, ) @@ -107,6 +108,7 @@ class TestReport(ZulipTestCase): ] self.assertEqual(stats_mock.func_calls, expected_calls) + @override_settings(BROWSER_ERROR_REPORTING=True) def test_report_error(self): # type: () -> None email = 'hamlet@zulip.com' @@ -138,6 +140,6 @@ class TestReport(ZulipTestCase): self.assertEqual(report['more_info'], dict(foo='bar')) self.assertEqual(report['user_email'], email) - with self.settings(ERROR_REPORTING=False): + with self.settings(BROWSER_ERROR_REPORTING=False): result = self.client_post("/json/report_error", params) self.assert_json_success(result) diff --git a/zerver/views/report.py b/zerver/views/report.py index 78af5ea635..a073191efd 100644 --- a/zerver/views/report.py +++ b/zerver/views/report.py @@ -82,7 +82,7 @@ def json_report_error(request, user_profile, message=REQ(), stacktrace=REQ(), # type: (HttpRequest, UserProfile, Text, Text, bool, Text, Text, Text, Dict[str, Any]) -> HttpResponse """Accepts an error report and stores in a queue for processing. The actual error reports are later handled by do_report_error (below)""" - if not settings.ERROR_REPORTING: + if not settings.BROWSER_ERROR_REPORTING: return json_success() if js_source_map: diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py index ee45c0a606..20df0ebdb7 100644 --- a/zproject/prod_settings_template.py +++ b/zproject/prod_settings_template.py @@ -135,11 +135,11 @@ ENABLE_FEEDBACK = False # be sent to that email address. FEEDBACK_EMAIL = ZULIP_ADMINISTRATOR -# Controls whether or not error reports are sent to Zulip. Error -# reports are used to improve the quality of the product and do not -# include message contents; please contact Zulip support with any -# questions. -ERROR_REPORTING = True +# Controls whether or not error reports (tracebacks) are emailed to the +# server administrators. +#ERROR_REPORTING = True +# For frontend (JavaScript) tracebacks +#BROWSER_ERROR_REPORTING = False # Controls whether or not Zulip will provide inline image preview when # a link to an image is referenced in a message. diff --git a/zproject/settings.py b/zproject/settings.py index c7174963a7..35b68b252b 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -113,6 +113,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'LOCAL_UPLOADS_DIR': None, 'MAX_FILE_UPLOAD_SIZE': 25, 'ERROR_REPORTING': True, + 'BROWSER_ERROR_REPORTING': False, 'STAGING_ERROR_NOTIFICATIONS': False, 'EVENT_LOGS_ENABLED': False, 'SAVE_FRONTEND_STACKTRACES': False,