(js,html) Improve IMAP subscriptions manager

This commit is contained in:
Francis Lachapelle
2016-09-30 12:02:46 -04:00
parent f233b2a9a7
commit 268b8ea1c3
4 changed files with 34 additions and 22 deletions
@@ -8,7 +8,7 @@
* @constructor
* @param {object} futureAccountData
*/
function Account(futureAccountData, fetchAll) {
function Account(futureAccountData) {
// Data is immediately available
if (typeof futureAccountData.then !== 'function') {
angular.extend(this, futureAccountData);
@@ -24,14 +24,6 @@
// The promise will be unwrapped first
//this.$unwrap(futureAccountData);
}
this.fetchAll = false;
// Check if we're displaying the IMAP subscription management dialog
if (angular.isDefined(fetchAll) && fetchAll) {
this.fetchAll = true;
this.$getMailboxes();
}
}
/**
@@ -187,7 +187,7 @@
clickOutsideToClose: true,
escapeToClose: true,
locals: {
srcApp: vm,
metadataForFolder: metadataForFolder,
srcAccount: account
}
}).finally(function() {
@@ -197,16 +197,25 @@
/**
* @ngInject
*/
SubscriptionsDialogController.$inject = ['$scope', '$mdDialog', 'srcApp', 'srcAccount'];
function SubscriptionsDialogController($scope, $mdDialog, srcApp, srcAccount) {
SubscriptionsDialogController.$inject = ['$scope', '$mdDialog', 'metadataForFolder', 'srcAccount'];
function SubscriptionsDialogController($scope, $mdDialog, metadataForFolder, srcAccount) {
var vm = this;
vm.app = srcApp;
vm.account = new Account({id: srcAccount.id,
name: srcAccount.name},
true);
vm.loading = true;
vm.filter = { name: '' };
vm.metadataForFolder = metadataForFolder;
vm.account = new Account({
id: srcAccount.id,
name: srcAccount.name
});
vm.close = close;
vm.account.$getMailboxes().then(function() {
vm.loading = false;
});
function close() {
$mdDialog.cancel();
}