Do not reload on logout (fixes #2868)
This commit is contained in:
parent
598dc30486
commit
c86f6d3684
@ -10,6 +10,10 @@ Version 2.2 (unreleased)
|
||||
Motions:
|
||||
- New export dialog.
|
||||
|
||||
Core:
|
||||
- No reload on logoff. OpenSlides is now a full single page application.
|
||||
|
||||
|
||||
Version 2.1.1 (2017-04-05)
|
||||
==========================
|
||||
[https://github.com/OpenSlides/OpenSlides/milestones/2.1.1]
|
||||
|
@ -76,11 +76,6 @@ angular.module('OpenSlidesApp.core', [
|
||||
Autoupdate.onMessage = function (receiver) {
|
||||
Autoupdate.messageReceivers.push(receiver);
|
||||
};
|
||||
Autoupdate.reconnect = function () {
|
||||
if (socket) {
|
||||
socket.close();
|
||||
}
|
||||
};
|
||||
Autoupdate.newConnect = function () {
|
||||
socket = new WebSocket(websocketProtocol + '//' + location.host + websocketPath);
|
||||
clearInterval(recInterval);
|
||||
@ -89,7 +84,9 @@ angular.module('OpenSlidesApp.core', [
|
||||
recInterval = setInterval(function () {
|
||||
Autoupdate.newConnect();
|
||||
}, 1000);
|
||||
if (event.code !== 1000) { // 1000 is a normal close, like the close on logout
|
||||
ErrorMessage.setConnectionError();
|
||||
}
|
||||
};
|
||||
socket.onmessage = function (event) {
|
||||
_.forEach(Autoupdate.messageReceivers, function (receiver) {
|
||||
@ -102,6 +99,12 @@ angular.module('OpenSlidesApp.core', [
|
||||
ErrorMessage.clearConnectionError();
|
||||
};
|
||||
};
|
||||
Autoupdate.closeConnection = function () {
|
||||
if (socket) {
|
||||
socket.close();
|
||||
}
|
||||
Autoupdate.firstMessageDeferred = $q.defer();
|
||||
};
|
||||
return Autoupdate;
|
||||
}
|
||||
])
|
||||
|
@ -4,15 +4,18 @@
|
||||
|
||||
angular.module('OpenSlidesApp.core.start', [])
|
||||
|
||||
.run([
|
||||
.factory('OpenSlides', [
|
||||
'$http',
|
||||
'$rootScope',
|
||||
'$state',
|
||||
'DS',
|
||||
'autoupdate',
|
||||
'operator',
|
||||
'Group',
|
||||
'mainMenu',
|
||||
function($http, $rootScope, $state, autoupdate, operator, Group, mainMenu) {
|
||||
function($http, $rootScope, $state, DS, autoupdate, operator, Group, mainMenu) {
|
||||
return {
|
||||
bootup: function () {
|
||||
$rootScope.openslidesBootstrapDone = false;
|
||||
$http.get('/users/whoami/').then(function (success) {
|
||||
$rootScope.guest_enabled = success.data.guest_enabled;
|
||||
@ -29,6 +32,27 @@ angular.module('OpenSlidesApp.core.start', [])
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
shutdown: function () {
|
||||
// Close connection, clear the store and show the OS overlay.
|
||||
autoupdate.closeConnection();
|
||||
DS.clear();
|
||||
operator.setUser(null);
|
||||
$rootScope.openslidesBootstrapDone = false;
|
||||
$rootScope.operator = operator;
|
||||
},
|
||||
reboot: function () {
|
||||
this.shutdown();
|
||||
this.bootup();
|
||||
},
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
.run([
|
||||
'OpenSlides',
|
||||
function (OpenSlides) {
|
||||
OpenSlides.bootup();
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -1397,17 +1397,15 @@ angular.module('OpenSlidesApp.users.site', [
|
||||
.controller('userMenu', [
|
||||
'$scope',
|
||||
'$http',
|
||||
'DS',
|
||||
'User',
|
||||
'operator',
|
||||
'OpenSlides',
|
||||
'ngDialog',
|
||||
'UserProfileForm',
|
||||
'UserPasswordForm',
|
||||
function($scope, $http, DS, User, operator, ngDialog, UserProfileForm, UserPasswordForm) {
|
||||
function($scope, $http, OpenSlides, ngDialog, UserProfileForm, UserPasswordForm) {
|
||||
$scope.logout = function () {
|
||||
$http.post('/users/logout/').then(function (response) {
|
||||
operator.setUser(null);
|
||||
window.location.reload();
|
||||
// Success: User logged out, so reboot OpenSlides.
|
||||
OpenSlides.reboot();
|
||||
});
|
||||
};
|
||||
$scope.editProfile = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user