From d61b6c2faac10812c234bcb64d16b373d3aa2650 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Apr 2017 14:24:24 -0400 Subject: [PATCH] force vault refresh upon importing --- src/app/config.js | 5 ++++- src/app/tools/toolsImportController.js | 2 +- src/app/vault/vaultController.js | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/config.js b/src/app/config.js index 349b8c281e..2c03791a6d 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -77,7 +77,10 @@ angular url: '^/vault', templateUrl: 'app/vault/views/vault.html', controller: 'vaultController', - data: { pageTitle: 'My Vault' } + data: { pageTitle: 'My Vault' }, + params: { + refreshFromServer: false + } }) .state('backend.user.subvaults', { url: '^/subvaults', diff --git a/src/app/tools/toolsImportController.js b/src/app/tools/toolsImportController.js index e03f278b2b..2acdaf6e13 100644 --- a/src/app/tools/toolsImportController.js +++ b/src/app/tools/toolsImportController.js @@ -239,7 +239,7 @@ folderRelationships: folderRelationships }, function () { $uibModalInstance.dismiss('cancel'); - $state.go('backend.user.vault').then(function () { + $state.go('backend.user.vault', { refreshFromServer: true }).then(function () { $analytics.eventTrack('Imported Data', { label: $scope.model.source }); toastr.success('Data has been successfully imported into your vault.', 'Import Success'); }); diff --git a/src/app/vault/vaultController.js b/src/app/vault/vaultController.js index 16f99ce25f..7ba06b6d9b 100644 --- a/src/app/vault/vaultController.js +++ b/src/app/vault/vaultController.js @@ -2,11 +2,15 @@ .module('bit.vault') .controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr, - cipherService, $q, $localStorage, $timeout, $rootScope) { + cipherService, $q, $localStorage, $timeout, $rootScope, $state) { $scope.loading = true; $scope.logins = []; $scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders; + if ($state.params.refreshFromServer) { + $rootScope.vaultFolders = $rootScope.vaultLogins = null; + } + $scope.$on('$viewContentLoaded', function () { if ($rootScope.vaultFolders && $rootScope.vaultLogins) { $scope.loading = false;