Before we switched to the custom editor, we had to rely on the 'save_post' hook
to ensure the newsletter entity is correctly created.
The code with hook was rather complex and was causing issues with duplication
of a newsletter so it seems more convenient to create a newsletter via API
similarly as we do in the current editor.
[MAILPOET-5810]
The method is used in API for creating a new newsletter.
To be able to use the API for the new editor, we also need to
make sure that a WP Post is created.
For now, we can signal that the email is intended for a new editor
by adding a flag to the initial data.
[MAILPOET-5810]
In 3394568, SendingQueue::stopProgress() was refactored to use Doctrine
but a typo introduced a bug causing this method to set
ScheduledTaskEntity::inProgress to true instead of false:
3394568792 (diff-3a26b2d8faf9cc01efd5aef47b058c088c0de01b8074c3be7cefd9adb77fbaaaR551)
This luckly was caught by the
EditorCouponCest.php:seeNoticeWhenCouponCantGenerateAndResumeSending
acceptance test.
This commit fixes the problem and also adds two integration tests to
protect against similar regressions in the future.
[MAILPOET-5682]
Newsletter::preProcessNewsletter() was refactored in a previous commit
to use Doctrine instead of Paris. As a result, the signature of this
method was changed, but one call was left using the old signature and
passing a Paris model instead of a Doctrine entity. This commit fixes
this issue.
[MAILPOET-5682]
While working on the previous commit, I noticed that we had a test to
check removing subscribers that are not part of a segment associated
with a newsletter when sending
(testItRemovesSubscribersFromProcessingListWhenNewsletterHasSegmentAndSubscriberIsNotPartOfIt()).
But SendingQueue::processSending() also handles removing subscribers
when sending newsletters without segments. And there was not test to
cover this part of the code.
[MAILPOET-5682]
This commit also removes Sending::getSendingQueueEntity() as the last
calls to this method were removed when refactoring SendingQueueTest.
[MAILPOET-5682]
In 862c395d3263f30057aef73a14704345e181dde3, SendingErrorHandler was
refactored to replace the `\MailPoet\Tasks\Sending` class with Doctrine
code. Inside `processSoftError()`, a call to
`$sendingTask->saveSubscriberError()` was replaced with a call to
`$this->scheduledTaskSubscribersRepository->saveError()`. The problem is
that the former updates the processed and unprocessed counts in the
QueueEntity while the later doesn't.
This commit fixes this issue by calling
`$this->sendingQueuesRepository->updateCounts()` inside
`processSoftError()`.
[MAILPOET-5682]