From 322fc52cd5f3bd78f674846697f7e00adbc50e47 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 23 Apr 2018 12:13:21 -0700 Subject: [PATCH] people: Suppress reporting late user additions when reloading. If the browser is in the progress of reloading when it finishes fetching some messages, it's not really a bug, and we shouldn't report it as such. This should help make Zulip's browser error reporting less spammy. --- frontend_tests/node_tests/people_errors.js | 9 +++++++++ static/js/people.js | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js index c3029e6c7f..835f01f705 100644 --- a/frontend_tests/node_tests/people_errors.js +++ b/frontend_tests/node_tests/people_errors.js @@ -1,4 +1,7 @@ zrequire('people'); +set_global('reload', { + is_in_progress: false, +}); set_global('blueslip', global.make_zblueslip({ debug: true, // testing for debug is disabled by default. @@ -20,6 +23,12 @@ people.initialize_current_user(me.user_id); people.report_late_add(55, 'foo@example.com'); assert.equal(blueslip.get_test_logs('error').length, 1); blueslip.clear_test_data(); + + reload.is_in_progress = true; + people.report_late_add(55, 'foo@example.com'); + // TODO: Make zblueslip support logging things written to .log and assert result + assert.equal(blueslip.get_test_logs('error').length, 0); + blueslip.clear_test_data(); }()); (function test_blueslip() { diff --git a/static/js/people.js b/static/js/people.js index 835bd91dd8..35f67b3649 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -754,7 +754,11 @@ exports.report_late_add = function (user_id, email) { // types of realms. var msg = 'Added user late: user_id=' + user_id + ' email=' + email; - blueslip.error(msg); + if (reload.is_in_progress) { + blueslip.log(msg); + } else { + blueslip.error(msg); + } }; exports.extract_people_from_message = function (message) {