From 0515b650ca2be6ada5de2ea5c107426d8f3a2361 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 27 Feb 2020 10:47:14 -0800 Subject: [PATCH] mail from validation: add busy indicator --- src/views/email.html | 5 ++++- src/views/email.js | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/views/email.html b/src/views/email.html index 31232b630..058b0cda1 100644 --- a/src/views/email.html +++ b/src/views/email.html @@ -520,7 +520,10 @@ Masquerading allows users and apps to send emails with an arbitrary username in the FROM address
- +
diff --git a/src/views/email.js b/src/views/email.js index 587f41537..38ac5a146 100644 --- a/src/views/email.js +++ b/src/views/email.js @@ -184,11 +184,25 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio } }; - $scope.toggleMailFromValidation = function () { - Client.setMailFromValidation($scope.domain.domain, !$scope.domain.mailConfig.mailFromValidation, function (error) { - if (error) return console.error(error); - $scope.refreshDomain(); - }); + $scope.mailFromValidation = { + busy: false, + + submit: function () { + $scope.mailFromValidation.busy = true; + + Client.setMailFromValidation($scope.domain.domain, !$scope.domain.mailConfig.mailFromValidation, function (error) { + if (error) { + $scope.mailFromValidation.busy = false; + return console.error(error); + } + + // give sometime for the mail container to restart + $timeout(function () { + $scope.mailFromValidation.busy = false; + $scope.refreshDomain(); + }, 5000); + }); + } }; $scope.incomingEmail = {