Ensure catchall uses the same origin array as the dropdown model

Otherwise angular would not reliably detect the same objects
This commit is contained in:
Johannes Zellner
2020-12-18 16:56:09 +01:00
parent 98ac637ada
commit 0bed8c89f6
2 changed files with 6 additions and 3 deletions

View File

@@ -44,6 +44,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
$scope.catchall = {
mailboxes: [],
availableMailboxes: [],
busy: false,
submit: function () {
@@ -59,11 +60,13 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
},
refresh: function () {
Client.getMailboxes($scope.domain.domain, '', 1, 1000, function (error, mailboxes) {
Client.getMailboxes($scope.domain.domain, '', 1, 1000, function (error, result) {
if (error) return console.error(error);
$scope.catchall.availableMailboxes = result;
$scope.catchall.mailboxes = $scope.domain.mailConfig.catchAll.map(function (name) {
return mailboxes.find(function (m) { return m.name === name; });
return $scope.catchall.availableMailboxes.find(function (m) { return m.name === name; });
}).filter(function (m) { return !!m; });
});
}