From af2b1ef3a1535257e395c195f72eb34c4ea0c730 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 20 May 2021 11:14:17 -0700 Subject: [PATCH] page_params: Remove duplicate debug_mode field. This had the same value as development_environment, I believe in a way likely to persist long term, and was less clear about its meaning. --- static/js/blueslip.js | 6 +++--- zerver/context_processors.py | 2 +- zerver/lib/home.py | 5 ++--- zerver/tests/test_home.py | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/static/js/blueslip.js b/static/js/blueslip.js index ca33b0e079..ad51d5b238 100644 --- a/static/js/blueslip.js +++ b/static/js/blueslip.js @@ -81,7 +81,7 @@ function report_error( stack = "No stacktrace available", {show_ui_msg = false, more_info} = {}, ) { - if (page_params.debug_mode) { + if (page_params.development_environment) { // In development, we display blueslip errors in the web UI, // to make them hard to miss. blueslip_stacktrace.display_stacktrace(msg, stack); @@ -228,7 +228,7 @@ export function info(msg, more_info) { export function warn(msg, more_info) { const args = build_arg_list(msg, more_info); logger.warn(...args); - if (page_params.debug_mode) { + if (page_params.development_environment) { console.trace(); } } @@ -238,7 +238,7 @@ export function error(msg, more_info, stack = new Error("dummy").stack) { logger.error(...args); report_error(msg, stack, {more_info}); - if (page_params.debug_mode) { + if (page_params.development_environment) { throw new BlueslipError(msg, more_info); } diff --git a/zerver/context_processors.py b/zerver/context_processors.py index 024240d6fd..d998aae440 100644 --- a/zerver/context_processors.py +++ b/zerver/context_processors.py @@ -30,7 +30,7 @@ from zproject.backends import ( ) DEFAULT_PAGE_PARAMS = { - "debug_mode": settings.DEBUG, + "development_environment": settings.DEVELOPMENT, "webpack_public_path": staticfiles_storage.url(settings.WEBPACK_BUNDLES), } diff --git a/zerver/lib/home.py b/zerver/lib/home.py index 3c0b6c5a57..5743a722e3 100644 --- a/zerver/lib/home.py +++ b/zerver/lib/home.py @@ -220,8 +220,7 @@ def build_page_params_for_home_page_load( # Pass parameters to the client-side JavaScript code. # These end up in a JavaScript Object named 'page_params'. page_params = dict( - # Server settings. - debug_mode=settings.DEBUG, + ## Server settings. test_suite=settings.TEST_SUITE, poll_timeout=settings.POLL_TIMEOUT, insecure_desktop_app=insecure_desktop_app, @@ -232,7 +231,7 @@ def build_page_params_for_home_page_load( search_pills_enabled=settings.SEARCH_PILLS_ENABLED, # Only show marketing email settings if on Zulip Cloud enable_marketing_emails_enabled=settings.CORPORATE_ENABLED, - # Misc. extra data. + ## Misc. extra data. default_language_name=get_language_name(register_ret["default_language"]), language_list_dbl_col=get_language_list_for_templates(register_ret["default_language"]), language_list=get_language_list(), diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 36e8abac76..630be67199 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -57,7 +57,6 @@ class HomeTest(ZulipTestCase): "cross_realm_bots", "custom_profile_field_types", "custom_profile_fields", - "debug_mode", "default_language", "default_language_name", "default_view",