Show the old admin notice when using free email
This commit is contained in:
committed by
M. Shull
parent
68708fc6ad
commit
e1f9c93276
@ -91,17 +91,6 @@ class MailPoetMapper {
|
||||
|
||||
private function getUnauthorizedEmailMessage($sender, $newsletter) {
|
||||
$email = $sender ? $sender['from_email'] : null;
|
||||
if ($email && (new FreeDomains())->isEmailOnFreeDomain($email)) {
|
||||
$message = '<p>' . sprintf(WPFunctions::get()->__('The MailPoet Sending Service can’t send email with the email address <i>%s</i>. You need to use an address like <i>you@yourdomain.com</i>.', 'mailpoet'), $email) . '</p>';
|
||||
$message .= '<p>';
|
||||
if ($newsletter && $newsletter['id']) {
|
||||
$message .= '<a class="button button-primary" href="admin.php?page=mailpoet-newsletters#/send/' . $newsletter['id'] .'">';
|
||||
} else {
|
||||
$message .= '<a class="button button-primary" href="admin.php?page=mailpoet-settings">';
|
||||
}
|
||||
$message .= WPFunctions::get()->__('Change my email address', 'mailpoet');
|
||||
$message .= '</a>';
|
||||
} else {
|
||||
$message = sprintf(WPFunctions::get()->__('<p>The MailPoet Sending Service did not send your latest email because the address <i>%s</i> is not yet authorized.</p>', 'mailpoet'), $email ?: WPFunctions::get()->__('Unknown address'));
|
||||
$message .= '<p>';
|
||||
$message .= Helpers::replaceLinkTags(
|
||||
@ -113,7 +102,6 @@ class MailPoetMapper {
|
||||
'rel' => 'noopener noreferrer',
|
||||
)
|
||||
);
|
||||
}
|
||||
$message .= ' <button class="button js-button-resume-sending">' . WPFunctions::get()->__('Resume sending', 'mailpoet') . '</button>';
|
||||
$message .= '</p>';
|
||||
$message .= "<script>jQuery('.js-button-resume-sending').on('click', function() { MailPoet.Ajax.post({ api_version: window.mailpoet_api_version, endpoint: 'mailer', action: 'resumeSending' }).done(function() { jQuery('.js-error-unauthorized-email').slideUp(); MailPoet.Notice.success('" . WPFunctions::get()->__('Sending has been resumed.') . "'); if (window.mailpoet_listing) { window.mailpoet_listing.forceUpdate(); }}).fail(function(response) { if (response.errors.length > 0) { MailPoet.Notice.error(response.errors.map(function(error) { return error.message }), { scroll: true }); }}); })</script>";
|
||||
|
@ -45,9 +45,9 @@ class UnauthorizedAddressCest {
|
||||
$I->wait(2);
|
||||
$I->amOnMailpoetPage('Emails');
|
||||
$I->waitForElement('.mailpoet_notice.notice-error');
|
||||
$I->see('The MailPoet Sending Service can’t send email with the email address ' . $newsletter_from, '.notice-error');
|
||||
$href = $I->grabAttributeFrom('//a[text()="Change my email address"]', 'href');
|
||||
expect($href)->endsWith('page=mailpoet-newsletters#/send/' . $newsletter->id);
|
||||
$I->see('The MailPoet Sending Service did not send your latest email because the address ' . $newsletter_from, '.notice-error');
|
||||
$href = $I->grabAttributeFrom('//a[text()="Authorize your email in your account now."]', 'href');
|
||||
expect($href)->equals('https://account.mailpoet.com/authorization');
|
||||
|
||||
// step 5 - Trash newsletter and resume sending
|
||||
$I->clickItemRowActionByItemName($newsletter_title, 'Move to trash');
|
||||
|
Reference in New Issue
Block a user