Browse Source

Merge pull request #2448 from nextcloud/errorreload-login

only reload on errors when logged in
tags/v11.0RC2
Robin Appelman 7 years ago
parent
commit
bc597b1843
2 changed files with 5 additions and 1 deletions
  1. 1
    1
      core/js/js.js
  2. 4
    0
      core/js/tests/specs/coreSpec.js

+ 1
- 1
core/js/js.js View File

@@ -776,7 +776,7 @@ var OCP = {},
return;
}

if (_.contains([302, 303, 307, 401], xhr.status)) {
if (_.contains([302, 303, 307, 401], xhr.status) && OC.currentUser) {
// sometimes "beforeunload" happens later, so need to defer the reload a bit
setTimeout(function() {
if (!self._userIsNavigatingAway && !self._reloadCalled) {

+ 4
- 0
core/js/tests/specs/coreSpec.js View File

@@ -969,8 +969,11 @@ describe('Core base tests', function() {
var reloadStub, ajaxErrorStub, clock;
var notificationStub;
var waitTimeMs = 6000;
var oldCurrentUser;

beforeEach(function() {
oldCurrentUser = OC.currentUser;
OC.currentUser = 'dummy';
clock = sinon.useFakeTimers();
reloadStub = sinon.stub(OC, 'reload');
notificationStub = sinon.stub(OC.Notification, 'show');
@@ -980,6 +983,7 @@ describe('Core base tests', function() {
window.initCore();
});
afterEach(function() {
OC.currentUser = oldCurrentUser;
reloadStub.restore();
notificationStub.restore();
clock.restore();

Loading…
Cancel
Save