mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	errors: Separate browser error reporting from backend.
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user