Merge pull request #2448 from nextcloud/errorreload-login
only reload on errors when logged in
This commit is contained in:
commit
bc597b1843
|
@ -776,7 +776,7 @@ var OCP = {},
|
||||||
return;
|
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
|
// sometimes "beforeunload" happens later, so need to defer the reload a bit
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!self._userIsNavigatingAway && !self._reloadCalled) {
|
if (!self._userIsNavigatingAway && !self._reloadCalled) {
|
||||||
|
|
|
@ -969,8 +969,11 @@ describe('Core base tests', function() {
|
||||||
var reloadStub, ajaxErrorStub, clock;
|
var reloadStub, ajaxErrorStub, clock;
|
||||||
var notificationStub;
|
var notificationStub;
|
||||||
var waitTimeMs = 6000;
|
var waitTimeMs = 6000;
|
||||||
|
var oldCurrentUser;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
oldCurrentUser = OC.currentUser;
|
||||||
|
OC.currentUser = 'dummy';
|
||||||
clock = sinon.useFakeTimers();
|
clock = sinon.useFakeTimers();
|
||||||
reloadStub = sinon.stub(OC, 'reload');
|
reloadStub = sinon.stub(OC, 'reload');
|
||||||
notificationStub = sinon.stub(OC.Notification, 'show');
|
notificationStub = sinon.stub(OC.Notification, 'show');
|
||||||
|
@ -980,6 +983,7 @@ describe('Core base tests', function() {
|
||||||
window.initCore();
|
window.initCore();
|
||||||
});
|
});
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
|
OC.currentUser = oldCurrentUser;
|
||||||
reloadStub.restore();
|
reloadStub.restore();
|
||||||
notificationStub.restore();
|
notificationStub.restore();
|
||||||
clock.restore();
|
clock.restore();
|
||||||
|
|
Loading…
Reference in New Issue