message view: Fix hiding of connection-error message on narrowing streams.

When there is some error in connecting to server(more specifically to the
tornado server) the "Unable to connect to Zulip" connection error message
gets cleared as Django server could send the response of "get" request of
old messages and hence get_old_messages_success hides the error message
even though the connection is not properly established.

Fixes: #5599.
This commit is contained in:
Shubham Dhama
2018-02-25 17:31:38 +05:30
committed by Tim Abbott
parent 2889de6d90
commit 01927fb470
3 changed files with 11 additions and 3 deletions

View File

@@ -184,6 +184,7 @@ function get_events(options) {
get_events_xhr = undefined;
get_events_failures = 0;
ui_report.hide_error($("#connection-error"));
$("#connection-error").removeClass('get-events-error');
get_events_success(data.events);
} catch (ex) {
@@ -215,14 +216,17 @@ function get_events(options) {
// Retry indefinitely on timeout.
get_events_failures = 0;
ui_report.hide_error($("#connection-error"));
$("#connection-error").removeClass('get-events-error');
} else {
get_events_failures += 1;
}
if (get_events_failures >= 5) {
ui_report.show_error($("#connection-error"));
$("#connection-error").addClass('get-events-error');
} else {
ui_report.hide_error($("#connection-error"));
$("#connection-error").removeClass('get-events-error');
}
} catch (ex) {
blueslip.error('Failed to handle get_events error\n' +