Display warning for cron accessibility problem [MAILPOET-801]
This commit is contained in:
@ -448,7 +448,45 @@ const MailerMixin = {
|
||||
},
|
||||
};
|
||||
|
||||
const CronMixin = {
|
||||
checkCronStatus: (state) => {
|
||||
if (state.meta.cron_accessible !== false) {
|
||||
MailPoet.Notice.hide('mailpoet_cron_error');
|
||||
return;
|
||||
}
|
||||
|
||||
const cronPingCheckNotice = ReactStringReplace(
|
||||
MailPoet.I18n.t('cronNotAccessibleNotice'),
|
||||
/\[link\](.*?)\[\/link\]/g,
|
||||
match => (
|
||||
<a
|
||||
href="https://beta.docs.mailpoet.com/article/231-sending-does-not-work"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
key="check-cron"
|
||||
>
|
||||
{ match }
|
||||
</a>
|
||||
)
|
||||
);
|
||||
|
||||
MailPoet.Notice.error(
|
||||
'',
|
||||
{ static: true, id: 'mailpoet_cron_error' }
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
(
|
||||
<div>
|
||||
<p>{cronPingCheckNotice}</p>
|
||||
</div>
|
||||
),
|
||||
jQuery('[data-id="mailpoet_cron_error"]')[0]
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export { QueueMixin };
|
||||
export { StatisticsMixin };
|
||||
export { MailerMixin };
|
||||
export { CronMixin };
|
||||
|
@ -5,7 +5,10 @@ import Listing from 'listing/listing.jsx';
|
||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||
|
||||
import { MailerMixin } from 'newsletters/listings/mixins.jsx';
|
||||
import {
|
||||
MailerMixin,
|
||||
CronMixin,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import MailPoet from 'mailpoet';
|
||||
@ -155,7 +158,7 @@ const newsletterActions = [
|
||||
];
|
||||
|
||||
const NewsletterListNotification = React.createClass({
|
||||
mixins: [MailerMixin],
|
||||
mixins: [MailerMixin, CronMixin],
|
||||
updateStatus: function updateStatus(e) {
|
||||
// make the event persist so that we can still override the selected value
|
||||
// in the ajax callback
|
||||
@ -330,7 +333,7 @@ const NewsletterListNotification = React.createClass({
|
||||
auto_refresh
|
||||
sort_by="updated_at"
|
||||
sort_order="desc"
|
||||
afterGetItems={this.checkMailerStatus}
|
||||
afterGetItems={(state) => { this.checkMailerStatus(state); this.checkCronStatus(state); }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
QueueMixin,
|
||||
StatisticsMixin,
|
||||
MailerMixin,
|
||||
CronMixin,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
|
||||
const mailpoetTrackingEnabled = (!!(window.mailpoet_tracking_enabled));
|
||||
@ -57,7 +58,7 @@ Hooks.addFilter('mailpoet_newsletters_listings_notification_history_actions', St
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_notification_history_actions', newsletterActions);
|
||||
|
||||
const NewsletterListNotificationHistory = React.createClass({
|
||||
mixins: [QueueMixin, StatisticsMixin, MailerMixin],
|
||||
mixins: [QueueMixin, StatisticsMixin, MailerMixin, CronMixin],
|
||||
renderItem: function renderItem(newsletter, actions, meta) {
|
||||
const rowClasses = classNames(
|
||||
'manage-column',
|
||||
@ -120,7 +121,7 @@ const NewsletterListNotificationHistory = React.createClass({
|
||||
auto_refresh
|
||||
sort_by="sent_at"
|
||||
sort_order="desc"
|
||||
afterGetItems={this.checkMailerStatus}
|
||||
afterGetItems={(state) => { this.checkMailerStatus(state); this.checkCronStatus(state); }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
QueueMixin,
|
||||
StatisticsMixin,
|
||||
MailerMixin,
|
||||
CronMixin,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
|
||||
const mailpoetTrackingEnabled = (!!(window.mailpoet_tracking_enabled));
|
||||
@ -172,7 +173,7 @@ Hooks.addFilter('mailpoet_newsletters_listings_standard_actions', StatisticsMixi
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_standard_actions', newsletterActions);
|
||||
|
||||
const NewsletterListStandard = React.createClass({
|
||||
mixins: [QueueMixin, StatisticsMixin, MailerMixin],
|
||||
mixins: [QueueMixin, StatisticsMixin, MailerMixin, CronMixin],
|
||||
renderItem: function renderItem(newsletter, actions, meta) {
|
||||
const rowClasses = classNames(
|
||||
'manage-column',
|
||||
@ -233,7 +234,7 @@ const NewsletterListStandard = React.createClass({
|
||||
auto_refresh
|
||||
sort_by="sent_at"
|
||||
sort_order="desc"
|
||||
afterGetItems={this.checkMailerStatus}
|
||||
afterGetItems={(state) => { this.checkMailerStatus(state); this.checkCronStatus(state); }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -4,7 +4,11 @@ import Listing from 'listing/listing.jsx';
|
||||
import ListingTabs from 'newsletters/listings/tabs.jsx';
|
||||
import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||
|
||||
import { StatisticsMixin, MailerMixin } from 'newsletters/listings/mixins.jsx';
|
||||
import {
|
||||
StatisticsMixin,
|
||||
MailerMixin,
|
||||
CronMixin,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import MailPoet from 'mailpoet';
|
||||
@ -128,7 +132,7 @@ Hooks.addFilter('mailpoet_newsletters_listings_welcome_notification_actions', St
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_welcome_notification_actions', newsletterActions);
|
||||
|
||||
const NewsletterListWelcome = React.createClass({
|
||||
mixins: [StatisticsMixin, MailerMixin],
|
||||
mixins: [StatisticsMixin, MailerMixin, CronMixin],
|
||||
updateStatus: function updateStatus(e) {
|
||||
// make the event persist so that we can still override the selected value
|
||||
// in the ajax callback
|
||||
@ -312,7 +316,7 @@ const NewsletterListWelcome = React.createClass({
|
||||
auto_refresh
|
||||
sort_by="updated_at"
|
||||
sort_order="desc"
|
||||
afterGetItems={this.checkMailerStatus}
|
||||
afterGetItems={(state) => { this.checkMailerStatus(state); this.checkCronStatus(state); }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -6,6 +6,7 @@ use Carbon\Carbon;
|
||||
use MailPoet\API\JSON\Endpoint as APIEndpoint;
|
||||
use MailPoet\API\JSON\Error as APIError;
|
||||
use MailPoet\Config\AccessControl;
|
||||
use MailPoet\Cron\CronHelper;
|
||||
use MailPoet\Cron\Workers\SendingQueue\Tasks\Newsletter as NewsletterQueueTask;
|
||||
use MailPoet\Listing;
|
||||
use MailPoet\Models\Newsletter;
|
||||
@ -416,6 +417,7 @@ class Newsletters extends APIEndpoint {
|
||||
'groups' => $listing_data['groups'],
|
||||
'mta_log' => Setting::getValue('mta_log'),
|
||||
'mta_method' => Setting::getValue('mta.method'),
|
||||
'cron_accessible' => CronHelper::isDaemonAccessible(),
|
||||
'current_time' => WPFunctions::currentTime('mysql')
|
||||
));
|
||||
}
|
||||
|
@ -287,6 +287,7 @@
|
||||
'beta': __('Beta'),
|
||||
'errorWhileTakingScreenshot': __('An error occured while saving the template in "Recently sent"'),
|
||||
'selectAutomaticEmailsEventsHeading': __('Select %1s events'),
|
||||
'cronNotAccessibleNotice': __('Oops! There seems to be an issue with the sending on your website. [link]See our guide[/link] to solve this yourself.'),
|
||||
}) %>
|
||||
<% endblock %>
|
||||
|
||||
|
Reference in New Issue
Block a user