Add a feature flag for disabling all emails
This commit is contained in:
parent
dc685b2387
commit
f3b03ebc34
10 changed files with 71 additions and 32 deletions
|
@ -1273,7 +1273,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
return userService;
|
||||
}]);
|
||||
|
||||
$provide.factory('ExternalNotificationData', ['Config', function(Config) {
|
||||
$provide.factory('ExternalNotificationData', ['Config', 'Features', function(Config, Features) {
|
||||
var externalNotificationData = {};
|
||||
|
||||
var events = [
|
||||
|
@ -1327,7 +1327,8 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
'type': 'email',
|
||||
'title': 'E-mail address'
|
||||
}
|
||||
]
|
||||
],
|
||||
'enabled': Features.MAILING
|
||||
},
|
||||
{
|
||||
'id': 'webhook',
|
||||
|
@ -1407,7 +1408,13 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
};
|
||||
|
||||
externalNotificationData.getSupportedMethods = function() {
|
||||
return methods;
|
||||
var filtered = [];
|
||||
for (var i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].enabled !== false) {
|
||||
filtered.push(methods[i]);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
};
|
||||
|
||||
externalNotificationData.getEventInfo = function(event) {
|
||||
|
@ -2598,14 +2605,18 @@ quayApp.directive('userSetup', function () {
|
|||
},
|
||||
controller: function($scope, $location, $timeout, ApiService, KeyService, UserService) {
|
||||
$scope.sendRecovery = function() {
|
||||
$scope.sendingRecovery = true;
|
||||
|
||||
ApiService.requestRecoveryEmail($scope.recovery).then(function() {
|
||||
$scope.invalidRecovery = false;
|
||||
$scope.errorMessage = '';
|
||||
$scope.sent = true;
|
||||
$scope.sendingRecovery = false;
|
||||
}, function(result) {
|
||||
$scope.invalidRecovery = true;
|
||||
$scope.errorMessage = result.data;
|
||||
$scope.sent = false;
|
||||
$scope.sendingRecovery = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -2772,7 +2783,7 @@ quayApp.directive('signupForm', function () {
|
|||
controller: function($scope, $location, $timeout, ApiService, KeyService, UserService, Config, UIService) {
|
||||
$('.form-signup').popover();
|
||||
|
||||
$scope.awaitingConfirmation = false;
|
||||
$scope.awaitingConfirmation = false;
|
||||
$scope.registering = false;
|
||||
|
||||
$scope.register = function() {
|
||||
|
@ -2783,15 +2794,19 @@ quayApp.directive('signupForm', function () {
|
|||
$scope.newUser['inviteCode'] = $scope.inviteCode;
|
||||
}
|
||||
|
||||
ApiService.createNewUser($scope.newUser).then(function() {
|
||||
ApiService.createNewUser($scope.newUser).then(function(resp) {
|
||||
$scope.registering = false;
|
||||
$scope.awaitingConfirmation = true;
|
||||
$scope.awaitingConfirmation = !!resp['awaiting_verification'];
|
||||
|
||||
if (Config.MIXPANEL_KEY) {
|
||||
mixpanel.alias($scope.newUser.username);
|
||||
}
|
||||
|
||||
$scope.userRegistered({'username': $scope.newUser.username});
|
||||
|
||||
if (!$scope.awaitingConfirmation) {
|
||||
document.location = '/';
|
||||
}
|
||||
}, function(result) {
|
||||
$scope.registering = false;
|
||||
UIService.showFormError('#signupButton', result);
|
||||
|
|
Reference in a new issue