Unify list vs segment naming with a rest of codebase

[MAILPOET-3418]
This commit is contained in:
Rostislav Wolny
2021-04-01 13:51:42 +02:00
committed by Veljko V
parent 3dc5c5ce80
commit 3d2c62fc16
4 changed files with 9 additions and 9 deletions

View File

@ -32,7 +32,7 @@ class SendingQueue {
public $batchSize; public $batchSize;
const BATCH_SIZE = 20; const BATCH_SIZE = 20;
const TASK_BATCH_SIZE = 5; const TASK_BATCH_SIZE = 5;
const EMAIL_WITH_INVALID_LIST_OPTION = 'mailpoet_email_with_invalid_list'; const EMAIL_WITH_INVALID_SEGMENT_OPTION = 'mailpoet_email_with_invalid_segment';
/** @var StatsNotificationsScheduler */ /** @var StatsNotificationsScheduler */
public $statsNotificationsScheduler; public $statsNotificationsScheduler;
@ -131,7 +131,7 @@ class SendingQueue {
); );
$queue->status = ScheduledTaskEntity::STATUS_PAUSED; $queue->status = ScheduledTaskEntity::STATUS_PAUSED;
$queue->save(); $queue->save();
$this->wp->setTransient(self::EMAIL_WITH_INVALID_LIST_OPTION, $newsletter->subject); $this->wp->setTransient(self::EMAIL_WITH_INVALID_SEGMENT_OPTION, $newsletter->subject);
continue; continue;
} }

View File

@ -6,8 +6,8 @@ use MailPoet\Cron\Workers\SendingQueue\SendingQueue;
use MailPoet\WP\Functions as WPFunctions; use MailPoet\WP\Functions as WPFunctions;
use MailPoet\WP\Notice; use MailPoet\WP\Notice;
class EmailWithInvalidListNotice { class EmailWithInvalidSegmentNotice {
const OPTION_NAME = SendingQueue::EMAIL_WITH_INVALID_LIST_OPTION; const OPTION_NAME = SendingQueue::EMAIL_WITH_INVALID_SEGMENT_OPTION;
/** @var WPFunctions */ /** @var WPFunctions */
private $wp; private $wp;

View File

@ -35,7 +35,7 @@ class PermanentNotices {
/** @var DeprecatedShortcodeNotice */ /** @var DeprecatedShortcodeNotice */
private $deprecatedShortcodeNotice; private $deprecatedShortcodeNotice;
/** @var EmailWithInvalidListNotice */ /** @var EmailWithInvalidSegmentNotice */
private $emailWithInvalidListNotice; private $emailWithInvalidListNotice;
public function __construct(WPFunctions $wp) { public function __construct(WPFunctions $wp) {
@ -48,7 +48,7 @@ class PermanentNotices {
$this->blackFridayNotice = new BlackFridayNotice(); $this->blackFridayNotice = new BlackFridayNotice();
$this->headersAlreadySentNotice = new HeadersAlreadySentNotice(SettingsController::getInstance(), $wp); $this->headersAlreadySentNotice = new HeadersAlreadySentNotice(SettingsController::getInstance(), $wp);
$this->deprecatedShortcodeNotice = new DeprecatedShortcodeNotice(); $this->deprecatedShortcodeNotice = new DeprecatedShortcodeNotice();
$this->emailWithInvalidListNotice = new EmailWithInvalidListNotice($wp); $this->emailWithInvalidListNotice = new EmailWithInvalidSegmentNotice($wp);
} }
public function init() { public function init() {
@ -112,7 +112,7 @@ class PermanentNotices {
case (DeprecatedShortcodeNotice::OPTION_NAME): case (DeprecatedShortcodeNotice::OPTION_NAME):
$this->deprecatedShortcodeNotice->disable(); $this->deprecatedShortcodeNotice->disable();
break; break;
case (EmailWithInvalidListNotice::OPTION_NAME): case (EmailWithInvalidSegmentNotice::OPTION_NAME):
$this->emailWithInvalidListNotice->disable(); $this->emailWithInvalidListNotice->disable();
break; break;
} }

View File

@ -914,7 +914,7 @@ class SendingQueueTest extends \MailPoetTest {
$this->entityManager->refresh($newsletter); $this->entityManager->refresh($newsletter);
expect($task->getStatus())->equals(ScheduledTaskEntity::STATUS_PAUSED); expect($task->getStatus())->equals(ScheduledTaskEntity::STATUS_PAUSED);
expect($newsletter->getStatus())->equals(NewsletterEntity::STATUS_SENDING); expect($newsletter->getStatus())->equals(NewsletterEntity::STATUS_SENDING);
expect($this->wp->getTransient(SendingQueueWorker::EMAIL_WITH_INVALID_LIST_OPTION))->equals('Subject With Trashed'); expect($this->wp->getTransient(SendingQueueWorker::EMAIL_WITH_INVALID_SEGMENT_OPTION))->equals('Subject With Trashed');
} }
public function testItPauseSendingTaskThatHasDeletedSegment() { public function testItPauseSendingTaskThatHasDeletedSegment() {
@ -936,7 +936,7 @@ class SendingQueueTest extends \MailPoetTest {
$this->entityManager->refresh($newsletter); $this->entityManager->refresh($newsletter);
expect($task->getStatus())->equals(ScheduledTaskEntity::STATUS_PAUSED); expect($task->getStatus())->equals(ScheduledTaskEntity::STATUS_PAUSED);
expect($newsletter->getStatus())->equals(NewsletterEntity::STATUS_SENDING); expect($newsletter->getStatus())->equals(NewsletterEntity::STATUS_SENDING);
expect($this->wp->getTransient(SendingQueueWorker::EMAIL_WITH_INVALID_LIST_OPTION))->equals('Subject With Deleted'); expect($this->wp->getTransient(SendingQueueWorker::EMAIL_WITH_INVALID_SEGMENT_OPTION))->equals('Subject With Deleted');
} }
public function _after() { public function _after() {