diff --git a/static/scripts/app/views/notifications.js b/static/scripts/app/views/notifications.js index 5637092f2c..e2295e87a5 100644 --- a/static/scripts/app/views/notifications.js +++ b/static/scripts/app/views/notifications.js @@ -44,19 +44,26 @@ define([ $num.addClass('hide'); document.title = _this.orig_doc_title; } + + var $networkNotice = $('#network-top-notice'); + if ($networkNotice.is(':visible')) { + $networkNotice.remove(); + } }, error: function(xhr) { // e.g. 401 UNAUTHORIZED - clearInterval(reqInterval); // stop sending requests - var $el; if (xhr.responseText) { if (xhr.status == 401) { + clearInterval(reqInterval); // stop sending requests $el = $('

' + gettext("You have logged out.") + '' + gettext("Log in") + '

'); + $('#wrapper').prepend($el); } } else { - $el = $('

' + gettext("Please check the network.") + '

'); + if ($('#network-top-notice').length == 0) { + $el = $('

' + gettext("Please check the network.") + '' + gettext("Refresh") + '

'); + $('#wrapper').prepend($el); + } } - $('#wrapper').prepend($el); $('.top-bar-click', $el).click(function() { location.reload(true); });