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.
This commit is contained in:
Tim Abbott 2018-04-23 12:13:21 -07:00
parent ad1b043098
commit 322fc52cd5
2 changed files with 14 additions and 1 deletions

View File

@ -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() {

View File

@ -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) {