Commit Graph

258 Commits

Author SHA1 Message Date
Oluwaseun Olorunsola
639d779088 Unify ProcessedAt timezone
Fix a problem in the codebase where we create, schedule and update newsletters in the user time zone, but we set the ProcessedAt with another timezone

Also, `Carbon::createFromTimestamp($this->wp->currentTime('mysql'))` is not a valid date.
It would return date: '1970-01-01 00:35:29.000000'

MAILPOET-5795
2023-12-25 21:38:02 +01:00
Jan Lysý
525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00
John Oleksowicz
1b31ad11d4 Update UnsubscribeTokens to use DI
MAILPOET-5710
2023-11-13 10:35:54 +01:00
Jan Jakes
c0ef898dc0 Remove no longer needed Scheduler code
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
2d027d4482 Rewrite Scheduler::processScheduledTransactionalEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
a8a98478fe Rewrite Scheduler::processScheduledAutomationEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
bd193968b1 Rewrite Scheduler::processReEngagementEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
a488d0b275 Rewrite Scheduler::processScheduledAutomaticEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
d574b55b3f Rewrite Scheduler::processScheduledStandardNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
1ef88a5fb5 Rewrite Scheduler::processPostNotificationNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
6517c697d6 Rewrite Scheduler::processWelcomeNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
a1c0399e96 Implement scheduler task, queue, and subscribers removal with Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
e81a7c1517 Enable usage of both Doctrine and legacy task/queue entities in scheduler loop
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
b05bc86223 Remove usages of MailPoet\Tasks\Sending from renderer
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
728e1781c6 Remove usages of MailPoet\Tasks\Sending from stats notification worker
[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
Rodrigo Primo
4d3ee84e38 Improve query by getting only the ID as we don't need the rest
[MAILPOET-5680]
2023-10-30 09:56:38 +01:00
Rodrigo Primo
f2214c8cf9 Refactor UnsubscribeTokens to use Doctrine instead of Paris
[MAILPOET-5680]
2023-10-30 09:56:38 +01:00
John Oleksowicz
6e27fe58bc Add next run date logic for mixpanel reporting
MAILPOET-5161
2023-10-23 17:40:54 +02:00
John Oleksowicz
4855aaaa93 Register mixpanel worker
MAILPOET-5161
2023-10-23 17:40:54 +02:00
John Oleksowicz
933fb27265 Create cron worker for reporting mixpanel data
MAILPOET-5161
2023-10-23 17:40:54 +02:00
Jan Lysý
998a1ef1f0 Add method for sending recovery from an invalid state
[MAILPOET-4891]
2023-09-14 21:03:08 +02:00
David Remer
7ac2065b1a Track purchases regardless of status but return revenue status correctly
When we apply this commit every purchase will be tracked. When the shop manager updates an order
the status will be updated. For the statistics it will only return values for purchases with
the 'completed' status

[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
David Remer
317fdee2b6 Use getPurchaseStates helper method for past orders
[MAILPOET-5485]
2023-09-11 12:14:33 +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
38e709e3b1 Filter subscribers when creating scheduled tasks
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
David Remer
76c299c3d7 Remove global count methods.
In the previous commit, we removed the global count for our output. This commit removes
the logic as the only places where it was used was in recalculating the cache and since
the last commit, we do not use this value anymore

[MAILPOET-4487]
2023-08-18 13:35:13 +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
0d9a6345d1 Actually use the batch size
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
2078ddf292 Save last_subscriber_id as we go
Otherwise the task would always be starting at 0 if it times out

MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
fc410c2154 Make sure lastProcessedSubscriberId is always correct
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
73eae47a39 Add cron worker for backfilling engagement data
MAILPOET-5404
2023-07-12 15:48:03 +02:00
John Oleksowicz
b22217420f Track last sending at
MAILPOET-4998
2023-06-22 15:29:22 +02:00
Rodrigo Primo
cc03b21e32 Add return type to verifySubscriber()
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
7a82270769 Add types to verifyWPSubscriber() based on PR reviewer feedback
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
bb2c77de31 Simplify verifyMailpoetSubscriber() by setting types in the signature
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
06a2c4e2bc Refactor Scheduler to use SubscriberEntity instead of Subscriber model
It was necessary to add a call to SubscribersRepository::remove() to two
integration tests to make sure Doctrine cleared its internal cache.
Maybe this should be handled by SubscribersRepository::bulkDelete().

[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
b251fa8ee9 Replace SubscribeSegment model with Doctrine code in Scheduler
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
6da2b5ad82 Refactor Scheduler::process() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
2ea8309908 Refactor processScheduledAutomaticEmail() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
e24d12f641 Refactor verifyMailpoetSubscriber() and verifyWPSubscriber()
Refactor those two methods to use Doctrine instead of Paris.

[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
fcc2f93d91 Refactor deleteQueueOrUpdateNextRunDate() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
5e9b820607 Refactor processPostNotificationNewsletter() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
0c74a5ae8c Refactor processWelcomeNewsletter() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
3b46668784 Refactor processScheduledStandardNewsletter() to use Doctrine
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
ca3b5032ca Replace Newsletter model with NewsletterEntity in SchedulerTest
Temporary code was added to Scheduler to make some of its methods work
both with a Newsletter model and a NewsletterEntity.

[MAILPOET-4370]
2023-05-30 13:12:29 +02:00