mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-26 20:22:22 +00:00
Clean data when user logs out
This commit is contained in:
parent
cc2cee4af6
commit
3ed39ad20e
@ -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();
|
||||||
@ -73,7 +73,10 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
|||||||
// Clean permanent data
|
// Clean permanent data
|
||||||
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,13 +36,19 @@ 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;
|
||||||
|
|
||||||
|
var reset = function() {
|
||||||
|
initialSyncDeferred = $q.defer();
|
||||||
|
|
||||||
|
$rootScope.events = {
|
||||||
|
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
reset();
|
||||||
|
|
||||||
var initialSyncDeferred = $q.defer();
|
|
||||||
|
|
||||||
$rootScope.events = {
|
|
||||||
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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
|
||||||
// of the app, given we never try to reap memory yet)
|
// of the app, given we never try to reap memory yet)
|
||||||
@ -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
|
||||||
@ -139,6 +139,11 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Clean data when user logs out
|
||||||
|
$scope.$on(eventHandlerService.RESET_EVENT, function() {
|
||||||
|
|
||||||
|
delete $rootScope.rooms;
|
||||||
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user