Reconfigure email apps when email is enabled/disabled
This commit is contained in:
@@ -206,6 +206,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
Client.enableMailForDomain($scope.selectedDomain.domain, true , function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.reconfigureEmailApps();
|
||||
|
||||
Client.setDnsRecords($scope.selectedDomain.domain, function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
@@ -223,6 +225,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
|
||||
Client.enableMailForDomain($scope.selectedDomain.domain, false , function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.reconfigureEmailApps();
|
||||
$scope.refreshDomain();
|
||||
$scope.incomingEmail.busy = false;
|
||||
});
|
||||
@@ -525,6 +529,18 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
$location.path('/email/' + $scope.selectedDomain.domain, false);
|
||||
};
|
||||
|
||||
// this is required because we need to rewrite the MAIL_DOMAINS env var
|
||||
$scope.reconfigureEmailApps = function () {
|
||||
var installedApps = Client.getInstalledApps();
|
||||
for (var i = 0; i < installedApps.length; i++) {
|
||||
if (!installedApps[i].manifest.addons.email) continue;
|
||||
|
||||
Client.configureApp(installedApps[i].id, { }, function (error) {
|
||||
if (error) console.error(error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.refreshDomain = function () {
|
||||
$scope.refreshBusy = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user