Don't send signup confirmation when signup confirmation is disabled

Fixed issue with select2 not selecting values by default on newsletter send step
This commit is contained in:
Jonathan Labreuille
2016-09-29 15:42:44 +02:00
parent 1faa53b978
commit 8c5aebc7d6
2 changed files with 14 additions and 3 deletions

View File

@ -89,10 +89,17 @@ function(
if(this.props.field['selected'] !== undefined) { if(this.props.field['selected'] !== undefined) {
return this.props.field['selected'](this.props.item); return this.props.field['selected'](this.props.item);
} else if(this.props.item !== undefined && this.props.field.name !== undefined) { } else if(this.props.item !== undefined && this.props.field.name !== undefined) {
return this.props.item[this.props.field.name]; if (this.allowMultipleValues()) {
} else { if (Array.isArray(this.props.item[this.props.field.name])) {
return null; return this.props.item[this.props.field.name].map(function(item) {
return item.id;
});
} }
} else {
return this.props.item[this.props.field.name];
}
}
return null;
}, },
loadCachedItems: function() { loadCachedItems: function() {
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') { if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {

View File

@ -75,6 +75,10 @@ class Subscriber extends Model {
function sendConfirmationEmail() { function sendConfirmationEmail() {
$signup_confirmation = Setting::getValue('signup_confirmation'); $signup_confirmation = Setting::getValue('signup_confirmation');
if((bool)$signup_confirmation['enabled'] === false) {
return false;
}
$segments = $this->segments()->findMany(); $segments = $this->segments()->findMany();
$segment_names = array_map(function($segment) { $segment_names = array_map(function($segment) {
return $segment->name; return $segment->name;