Various fixes to mailbox sharing ui
This commit is contained in:
+8
-23
@@ -157,9 +157,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
|
||||
$scope.mailboxSharing = {
|
||||
busy: false,
|
||||
error: null,
|
||||
size: 0,
|
||||
enable: false,
|
||||
enabled: false,
|
||||
enabled: null, // null means we have not refreshed yet
|
||||
|
||||
refresh: function () {
|
||||
Client.getMailboxSharing(function (error, enabled) {
|
||||
@@ -169,30 +167,17 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
$scope.mailboxSharing.busy = false;
|
||||
$scope.mailboxSharing.error = null;
|
||||
$scope.mailboxSharing.enable = $scope.mailboxSharing.enabled;
|
||||
|
||||
$scope.mailboxSharingChangeForm.$setUntouched();
|
||||
$scope.mailboxSharingChangeForm.$setPristine();
|
||||
|
||||
$('#mailboxSharingChangeModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.mailboxSharing.busy = true;
|
||||
|
||||
Client.setMailboxSharing($scope.mailboxSharing.enable, function (error) {
|
||||
$scope.mailboxSharing.busy = false;
|
||||
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.mailboxSharing.enabled = $scope.mailboxSharing.enable;
|
||||
|
||||
$('#mailboxSharingChangeModal').modal('hide');
|
||||
Client.setMailboxSharing(!$scope.mailboxSharing.enabled, function (error) {
|
||||
// give sometime for mail server to restart
|
||||
$timeout(function () {
|
||||
$scope.mailboxSharing.busy = false;
|
||||
if (error) return console.error(error);
|
||||
$scope.mailboxSharing.enabled = !$scope.mailboxSharing.enabled;
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user