Allow the user to setup a subscription when enabling email
This commit is contained in:
@@ -10,7 +10,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
$scope.client = Client;
|
||||
$scope.user = Client.getUserInfo();
|
||||
$scope.config = Client.getConfig();
|
||||
|
||||
$scope.hasSubscription = false;
|
||||
$scope.domains = [];
|
||||
$scope.users = [];
|
||||
$scope.selectedDomain = null;
|
||||
@@ -192,10 +192,25 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
if ($scope.selectedDomain.mailConfig.enabled) {
|
||||
$('#disableEmailModal').modal('show');
|
||||
} else {
|
||||
$('#enableEmailModal').modal('show');
|
||||
Client.getAppstoreConfig(function (error, appstoreConfig) {
|
||||
if (error) return console.error(error);
|
||||
if (!appstoreConfig.token) return;
|
||||
|
||||
AppStore.getSubscription(appstoreConfig, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.hasSubscription = result.plan.id !== 'free';
|
||||
|
||||
$('#enableEmailModal').modal('show');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.closeEnableEmailDialog = function () {
|
||||
$('#enableEmailModal').modal('hide');
|
||||
};
|
||||
|
||||
$scope.enableEmail = function () {
|
||||
$('#enableEmailModal').modal('hide');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user