Commit Graph

86 Commits

Author SHA1 Message Date
Rodrigo Primo
e7416c247c Fix error after refactor of SendingErrorHandler
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]
2024-01-12 13:25:46 +01:00
Jan Jakes
e3ff7ccaca Remove remaining usages of MailPoet\Task\Sending from SendingQueue::processSending()
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
fa266dadcd Rewrite SendingErrorHandler using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
7e45fb1c79 Rewrite SendingQueue::sendNewsletter(), sendNewsletters(), and processSendResult() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
586ef334b0 Rewrite SendingQueue\Tasks\Newsletter::prepareNewsletterForSending() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
44c5ae5664 Pass Doctrine entity into SendingQueue::processQueue(), replace simple usages
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
ec792b30df Rewrite SendingQueue\Tasks\Newsletter::preProcessNewsletter() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
c31cbb73c0 Rewrite SendingQueue\Tasks\Links::process() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
16b2817ce6 Rewrite SendingQueue\Tasks\Newsletter::getNewsletterFromQueue() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
737c80f953 Rewrite SendingQueue::deleteTaskIfNewsletterDoesNotExist() and deleteTask() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
ff9b2a1adb Pass Doctrine entity into SendingQueue::processSending(), replace simple usages
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Jan Jakes
6307f6c155 Rewrite SendingQueue::process() and progress/timeout functions using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
Oluwaseun Olorunsola
c76c8f2abb Save the correct datetime value for newsletter sentAt column
We don't need to use the value from `processedAt` here since we can rightfully use the current datetime value

Also, I found out `processedAt` is usually null here for standard newsletters which cause new Carbon to use the server datetime settings

MAILPOET-5795
2023-12-25 21:38:02 +01:00
Jan Jakes
b05bc86223 Remove usages of MailPoet\Tasks\Sending from renderer
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Rodrigo Primo
2736348feb Remove remaining use of SendingQueue model in Newsletter class
As far as I could test, calling validate() directly is not necessary.
The call to $sendingTask->save() right above calls validate() internaly
and then any errors will be returned by $sendingTask->getErrors().

I added a integration test that seems to confirm this interpretation.

[MAILPOET-4693]
2023-10-30 10:11:11 +01:00
Jan Lysý
998a1ef1f0 Add method for sending recovery from an invalid state
[MAILPOET-4891]
2023-09-14 21:03:08 +02:00
John Oleksowicz
fe44df1884 Prevent invalid states due to filter segment
MAILPOET-5509
2023-08-31 14:16:10 +02:00
John Oleksowicz
bb7a98ad82 Save filter segment data to queue at send time
MAILPOET-5509
2023-08-31 14:16:10 +02:00
John Oleksowicz
3745b17465 Filter subscribers during sending if filterSegment present
MAILPOET-5509
2023-08-31 14:16:10 +02:00
John Oleksowicz
9b8c4910c1 If newsletter has filterSegmentId, pause if it doesn't exist
MAILPOET-5509
2023-08-31 14:16:10 +02:00
John Oleksowicz
021d8774e7 Wrap bulk updates in a transaction
MAILPOET-5410
2023-08-11 16:39:57 +02:00
John Oleksowicz
f8e0ba118c Nullify engagement score updated at after sends
This will cause the cron job that recalculates engagement score to pick
up these users the next time it runs. This ensures scores don't get
stale.

MAILPOET-5410
2023-08-11 16:39:57 +02:00
John Oleksowicz
b22217420f Track last sending at
MAILPOET-4998
2023-06-22 15:29:22 +02:00
Rodrigo Primo
75f8af13be Refactor MetaInfo::getNewsletterMetaInfo() to use Doctrine
[MAILPOET-5344]
2023-05-25 06:52:00 -05:00
Rodrigo Primo
7c4a84aaf4 Remove notices for hooks that were deprecated over six months ago
[MAILPOET-5272]
2023-04-28 06:05:29 +01:00
Jan Jakes
69f21814e3 Rename "transactional" email type to "automation_transactional"
[MAILPOET-5258]
2023-04-24 09:54:08 +03:00
David Remer
0ce8fce161 Send transactional emails to all not-bounced subscribers
[MAILPOET-4999]
2023-04-17 13:59:39 +02:00
Sam Najian
397232e932 Set status of scheduled_task to invalid if it has not subs
[MAILPOET-5134]
2023-04-03 11:53:49 +02:00
Sam Najian
9ca259d1d0 Exclude corrupt emails when fetching queue newsletters
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Sam Najian
fdf0875905 Pause sending queue when encountering a corrupt newsletter
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Sam Najian
93110826e7 Log when processing the queue for corrupt newsletter
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
John Oleksowicz
8c0854ab47 Consider image src when calculating campaignIds
MAILPOET-5034
2023-02-26 15:20:48 +01:00
John Oleksowicz
49c85c05ed Move campaignId generation to more logical place
MAILPOET-5034
2023-02-26 15:20:48 +01:00
John Oleksowicz
a6824cce36 Add tests for campaignId generation
[MAILPOET-5033]
2023-02-26 15:20:48 +01:00
John Oleksowicz
fc8436ba74 Provide campaignId to sending methods via meta
[MAILPOET-5033]
2023-02-26 15:20:48 +01:00
John Oleksowicz
0435c09c53 Calculate and store campaign IDs on sending queues
[MAILPOET-5033]
2023-02-26 15:20:48 +01:00
Brezo Cordero
49b2f5528f Remove Migration class
Remove from container, test factory and PHPStan baselines.

[MAILPOET-4478]
2023-01-23 15:35:50 +01:00
Rostislav Wolny
78446d174a Fix quotes in a queries processed by $wpdb
These queries failed when ANSI_QUOTES mode is enabled
[MAILPOET-4887]
2022-12-12 13:59:09 +01:00
Jan Jakes
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
2557171953 Fix assert() in lib
[MAILPOET-4258]
2022-11-25 14:32:34 +01:00
Sam Najian
9204f37560 Remove redundant injection
[MAILPOET-4703]
2022-11-11 09:21:30 +01:00
Sam Najian
50b613365f Make sure one-click unsubscribe url won't redirect internally
[MAILPOET-4703]
2022-11-11 09:21:30 +01:00
David Remer
2298b5b061 Be more restrictive when deleting a queue task
getNewsletterFromQueue() has too many conditions under which it returns null. Therefore we can not rely on that method when we wont to delete running tasks with no associated newsletter.
[MAILPOET-4708]
2022-10-10 17:13:17 +02:00
David Remer
307989a0c6 Delete task when no newsletter was found
When no corresponding newsletter was found the task can be deleted. The behavior
before meant that such a task would remain forever in the database with the
status 'running'.

[MAILPOET-4699]
2022-10-06 12:06:13 +02:00
Rodrigo Primo
54ea394f82 Deprecate filter as part of a Doctrine refactor
This commit deprecates the filter
mailpoet_sending_newsletter_render_after and replaces it with
mailpoet_sending_newsletter_render_after_pre_process. This was necessary
because as part of a Doctrine refactor one of the parameters passed to
the old filter changed from a Newsletter model to a Newsletter entity.

[MAILPOET-4680]
2022-10-04 14:41:00 +02:00
Rodrigo Primo
d39440f1dc Refactor Newsletter::preProcessNewsletter() to use Doctrine
This commit also removes almost all the usages of the old Newsletter
model from NewsletterTest.

[MAILPOET-4680]
2022-10-04 14:41:00 +02:00
Rodrigo Primo
095cddc67e Change Posts::getAlcPostsCount() to use Doctine instead of Paris
[MAILPOET-4680]
2022-10-04 14:41:00 +02:00
Jan Lysý
58d32a68fb Use processedAt from the correct model
[MAILPOET-4685]
2022-09-29 15:19:09 -03:00
Rodrigo Primo
2c159b1694 Document the types of two SendingQueue properties that were undocumented
It was also necessary to add an if condition to check the type of a
variable before calling one of the methods of one of the documented
properties.

[MAILPOET-4363]
2022-09-21 16:03:21 +02:00
Rodrigo Primo
f578f3f16a Remove method Tasks\Newsletter\getNewsletterSegments()
This method was used only once inside SendingQueue and it can be
replaced by NewsletterEntity::getSegmentIds() to simplify the code.

[MAILPOET-4363]
2022-09-21 16:03:21 +02:00