Clear local database after encryption status change to clear indexeddb logs

This commit is contained in:
Mo Bitar
2017-12-12 16:41:47 -06:00
parent 9efecb9c59
commit cdff4cb326
2 changed files with 23 additions and 6 deletions

View File

@@ -154,13 +154,12 @@ class AccountMenu {
} }
if($scope.formData.mergeLocal) { if($scope.formData.mergeLocal) {
syncManager.markAllItemsDirtyAndSaveOffline(function(){
block();
}, true)
// Allows desktop to make backup file // Allows desktop to make backup file
$rootScope.$broadcast("major-data-change"); $rootScope.$broadcast("major-data-change");
} else { $scope.clearDatabaseAndRewriteAllItems(true, block);
}
else {
modelManager.resetLocalMemory(); modelManager.resetLocalMemory();
storageManager.clearAllModels(function(){ storageManager.clearAllModels(function(){
block(); block();
@@ -168,6 +167,17 @@ class AccountMenu {
} }
} }
// Allows indexeddb unencrypted logs to be deleted
// clearAllModels will remove data from backing store, but not from working memory
// See: https://github.com/standardnotes/desktop/issues/131
$scope.clearDatabaseAndRewriteAllItems = function(alternateUuids, callback) {
storageManager.clearAllModels(function(){
syncManager.markAllItemsDirtyAndSaveOffline(function(){
callback && callback();
}, alternateUuids)
});
}
$scope.destroyLocalData = function() { $scope.destroyLocalData = function() {
if(!confirm("Are you sure you want to end your session? This will delete all local items and extensions.")) { if(!confirm("Are you sure you want to end your session? This will delete all local items and extensions.")) {
return; return;
@@ -533,9 +543,9 @@ class AccountMenu {
}, 10); }, 10);
if(offline) { if(offline) {
syncManager.markAllItemsDirtyAndSaveOffline();
// Allows desktop to make backup file // Allows desktop to make backup file
$rootScope.$broadcast("major-data-change"); $rootScope.$broadcast("major-data-change");
$scope.clearDatabaseAndRewriteAllItems(false);
} }
}) })
}) })

View File

@@ -140,6 +140,13 @@ input, button, select, textarea {
line-height: inherit; line-height: inherit;
} }
button {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.checkbox { .checkbox {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;