Merge pull request #1575 from mailpoet/email-notifications-fix

New subscriber emails notifications fixes [MAILPOET-1952][MAILPOET-1600]
This commit is contained in:
M. Shull
2018-10-22 13:23:11 -04:00
committed by GitHub
3 changed files with 10 additions and 7 deletions

View File

@ -12,8 +12,7 @@
|replaceLinkTags(link_settings)
) %></small>
<# date('-1hour') is here to get today's date, this is the only way that worked for me #>
<% if date('-1hour') < date('2018-11-12') %>
<% if 'now'|date('Y-m-d') < '2018-11-30'|date('Y-m-d') %>
<p>
<small>
<%= __('PS. MailPoet annual plans are nearly half price for a limited time.

View File

@ -10,8 +10,7 @@
<%= __('You can disable these emails in your MailPoet Settings.') %>
<%= link_settings %>
<# date('-1hour') is here to get today's date, this is the only way that worked for me #>
<% if date('-1hour') < date('2018-11-12') %>
<% if 'now'|date('Y-m-d') < '2018-11-30'|date('Y-m-d') %>
<%= __('PS. MailPoet annual plans are nearly half price for a limited time. Find out more in the Premium page in your admin.') %>
<%= link_premium %>
<% endif %>

View File

@ -65,6 +65,7 @@
$(function() {
// on form submission
$('#mailpoet_settings_form').on('submit', function() {
var errorFound = false;
// Check if filled emails are valid
var invalidEmails = $.map($('#mailpoet_settings_form')[0].elements, function(el) {
return el.type === 'email' && el.value && !window.mailpoet_email_regex.test(el.value) ? el.value : null;
@ -74,7 +75,7 @@
"<%= __('Invalid email addresses: ') | escape('js') %>" + invalidEmails.join(', '),
{ scroll: true }
);
return false;
errorFound = true;
}
// if reCAPTCHA is enabled but keys are emty, show error
var enabled = $('input[name="re_captcha[enabled]"]:checked').val(),
@ -83,7 +84,7 @@
if (enabled && (site_key == '' || secret_key == '')) {
$('#settings_re_captcha_tokens_error').show();
window.location.href = '#advanced';
return false;
errorFound = true;
} else {
$('#settings_re_captcha_tokens_error').hide();
}
@ -93,10 +94,14 @@
if (notifications_enabled && address == '') {
$('#settings_subscriber_email_notification_error').show();
window.location.href = '#basics';
return false;
errorFound = true;
} else {
$('#settings_subscriber_email_notification_error').hide();
}
// stop processing if an error was found
if (errorFound) {
return false;
}
// if we're setting up a sending method, try to activate it
if ($('.mailpoet_mta_setup_save').is(':visible')) {
$('.mailpoet_mta_setup_save').trigger('click');