Use simple input field for custom data dir instead of checkbox (email)

This commit is contained in:
Girish Ramakrishnan
2019-09-19 18:00:18 -07:00
parent 6ffa00026e
commit 50d29f8ef0
2 changed files with 17 additions and 15 deletions

View File

@@ -365,17 +365,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.email = {
busy: false,
error: {},
success: false,
mailboxNameEnabled: false,
mailboxName: '',
domain: '',
show: function () {
var app = $scope.app;
$scope.emailForm.$setPristine();
$scope.email.error = {};
$scope.email.mailboxNameEnabled = app.mailboxName && (app.mailboxName.match(/\.app$/) === null);
$scope.email.mailboxName = app.mailboxName || '';
$scope.email.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
},
@@ -384,7 +382,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.email.error = {};
$scope.email.busy = true;
Client.configureApp($scope.app.id, 'mailbox', { mailboxName: $scope.email.mailboxNameEnabled ? $scope.email.mailboxName : null }, function (error) {
Client.configureApp($scope.app.id, 'mailbox', { mailboxName: $scope.email.mailboxName || null }, function (error) {
if (error && error.statusCode === 400) {
$scope.email.busy = false;
$scope.email.error.mailboxName = error.message;
@@ -393,10 +391,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
if (error) return Client.error(error);
$scope.email.success = true;
$scope.emailForm.$setPristine();
$scope.email.busy = false;
refreshApp();
refreshApp(function (error) {
if (error) return;
// when the mailboxName is 'reset', this will fill it up with the default again
$scope.email.mailboxName = $scope.app.mailboxName || '';
});
});
}
};