aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-12-02 14:37:12 +0100
committerGitHub <noreply@github.com>2016-12-02 14:37:12 +0100
commitbc597b184306aa39a48963cb9a8015354c6e2ce2 (patch)
tree8f710866a3396a5eeb36b55c0902a229fe5de20c
parent1b5ff9f5c704a1497fee7885656ea72978687d48 (diff)
parente055fbd4dab59c31edbc704b937bfd1d785d3f73 (diff)
downloadnextcloud-server-bc597b184306aa39a48963cb9a8015354c6e2ce2.tar.gz
nextcloud-server-bc597b184306aa39a48963cb9a8015354c6e2ce2.zip
Merge pull request #2448 from nextcloud/errorreload-login
only reload on errors when logged in
-rw-r--r--core/js/js.js2
-rw-r--r--core/js/tests/specs/coreSpec.js4
2 files changed, 5 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js
index e2b8731c877..972f0e63144 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -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) {
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 5d42f0881d4..d1734a9f3d1 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -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();