mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-19 18:14:00 +01:00
Clean data when user logs out
This commit is contained in:
parent
cc2cee4af6
commit
3ed39ad20e
4 changed files with 36 additions and 11 deletions
|
@ -21,8 +21,8 @@ limitations under the License.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService'])
|
angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService'])
|
||||||
.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', '$timeout', '$animate', 'matrixService', 'mPresence', 'eventStreamService', 'matrixPhoneService',
|
.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', '$timeout', '$animate', 'matrixService', 'mPresence', 'eventStreamService', 'eventHandlerService', 'matrixPhoneService',
|
||||||
function($scope, $location, $rootScope, $timeout, $animate, matrixService, mPresence, eventStreamService, matrixPhoneService) {
|
function($scope, $location, $rootScope, $timeout, $animate, matrixService, mPresence, eventStreamService, eventHandlerService, matrixPhoneService) {
|
||||||
|
|
||||||
// Check current URL to avoid to display the logout button on the login page
|
// Check current URL to avoid to display the logout button on the login page
|
||||||
$scope.location = $location.path();
|
$scope.location = $location.path();
|
||||||
|
@ -74,6 +74,9 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
||||||
matrixService.setConfig({});
|
matrixService.setConfig({});
|
||||||
matrixService.saveConfig();
|
matrixService.saveConfig();
|
||||||
|
|
||||||
|
// Reset cached data
|
||||||
|
eventHandlerService.reset();
|
||||||
|
|
||||||
// And go to the login page
|
// And go to the login page
|
||||||
$location.url("login");
|
$location.url("login");
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,12 +36,18 @@ angular.module('eventHandlerService', [])
|
||||||
var CALL_EVENT = "CALL_EVENT";
|
var CALL_EVENT = "CALL_EVENT";
|
||||||
var NAME_EVENT = "NAME_EVENT";
|
var NAME_EVENT = "NAME_EVENT";
|
||||||
var TOPIC_EVENT = "TOPIC_EVENT";
|
var TOPIC_EVENT = "TOPIC_EVENT";
|
||||||
|
var RESET_EVENT = "RESET_EVENT"; // eventHandlerService has been resetted
|
||||||
|
|
||||||
var initialSyncDeferred = $q.defer();
|
var initialSyncDeferred;
|
||||||
|
|
||||||
$rootScope.events = {
|
var reset = function() {
|
||||||
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
initialSyncDeferred = $q.defer();
|
||||||
};
|
|
||||||
|
$rootScope.events = {
|
||||||
|
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
reset();
|
||||||
|
|
||||||
// used for dedupping events - could be expanded in future...
|
// used for dedupping events - could be expanded in future...
|
||||||
// FIXME: means that we leak memory over time (along with lots of the rest
|
// FIXME: means that we leak memory over time (along with lots of the rest
|
||||||
|
@ -236,6 +242,12 @@ angular.module('eventHandlerService', [])
|
||||||
CALL_EVENT: CALL_EVENT,
|
CALL_EVENT: CALL_EVENT,
|
||||||
NAME_EVENT: NAME_EVENT,
|
NAME_EVENT: NAME_EVENT,
|
||||||
TOPIC_EVENT: TOPIC_EVENT,
|
TOPIC_EVENT: TOPIC_EVENT,
|
||||||
|
RESET_EVENT: RESET_EVENT,
|
||||||
|
|
||||||
|
reset: function() {
|
||||||
|
reset();
|
||||||
|
$rootScope.$broadcast(RESET_EVENT);
|
||||||
|
},
|
||||||
|
|
||||||
handleEvent: function(event, isLiveEvent, isStateEvent) {
|
handleEvent: function(event, isLiveEvent, isStateEvent) {
|
||||||
|
|
||||||
|
|
|
@ -142,4 +142,9 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Clean data when user logs out
|
||||||
|
$scope.$on(eventHandlerService.RESET_EVENT, function() {
|
||||||
|
$scope.public_rooms = [];
|
||||||
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -102,7 +102,7 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
|
||||||
}
|
}
|
||||||
|
|
||||||
return memberCount;
|
return memberCount;
|
||||||
}
|
};
|
||||||
|
|
||||||
$scope.onInit = function() {
|
$scope.onInit = function() {
|
||||||
// Init recents list only once
|
// Init recents list only once
|
||||||
|
@ -140,5 +140,10 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Clean data when user logs out
|
||||||
|
$scope.$on(eventHandlerService.RESET_EVENT, function() {
|
||||||
|
|
||||||
|
delete $rootScope.rooms;
|
||||||
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue