mailboxes: owner may not exist
This commit is contained in:
+4
-3
@@ -286,7 +286,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
|
||||
show: function (mailbox) {
|
||||
$scope.mailboxes.edit.name = mailbox.name;
|
||||
$scope.mailboxes.edit.owner = mailbox.owner;
|
||||
$scope.mailboxes.edit.owner = mailbox.owner; // this can be null if mailbox had no owner
|
||||
$scope.mailboxes.edit.aliases = mailbox.aliases;
|
||||
|
||||
$('#mailboxEditModal').modal('show');
|
||||
@@ -295,6 +295,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
submit: function () {
|
||||
$scope.mailboxes.edit.busy = true;
|
||||
|
||||
// $scope.mailboxes.edit.owner is expected to be validated by the UI
|
||||
Client.updateMailbox($scope.selectedDomain.domain, $scope.mailboxes.edit.name, $scope.mailboxes.edit.owner.id, function (error) {
|
||||
if (error) {
|
||||
$scope.mailboxes.edit.error = error;
|
||||
@@ -364,8 +365,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
|
||||
$scope.mailboxes.mailboxes = mailboxes.map(function (m) {
|
||||
m.aliases = aliases.filter(function (a) { return a.aliasTarget === m.name; }).map(function (a) { return a.name; }).join(',');
|
||||
m.owner = $scope.users.find(function (u) { return u.id === m.ownerId; });
|
||||
m.ownerDisplayName = m.owner.display; // this meta property is set when we get the user list
|
||||
m.owner = $scope.users.find(function (u) { return u.id === m.ownerId; }); // owner may not exist
|
||||
m.ownerDisplayName = m.owner ? m.owner.display : ''; // this meta property is set when we get the user list
|
||||
|
||||
return m;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user