Commit Graph

52 Commits

Author SHA1 Message Date
alex-mpoet
7ebcf324a6 Update code for the new cron-expression package
[MAILPOET-6167]
2024-08-26 14:52:05 +02:00
Rostislav Wolny
bb7ab59ed5 Improve readability of scheduler code
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Rostislav Wolny
07221d9c68 Get rid of unnecessary parameter in the Scheduler
The fromTimestamp parameter was used only in tests.
This commit replaces the parameter in tests by mocks and removes it.
 [MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Rostislav Wolny
506652bdc4 Fix scheduling post notifications
The user picks time in a select box, and we expect they pick a time
in the site's timezone so the saved cron expression is in the site's timezone.
When we calculate the next run date, we do it in the site's timezone and
to get UTC time, we convert it.
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Rostislav Wolny
33f4b2d729 Replace usage of WP's current_time without gmt parameter in libs
This commit replaces usages by Carbon::now or in case we need a timestamp it
keeps current_time but adds the gtm parameter as true.
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Jan Jakes
8c4b2cf3ef Replace deprecated Statement::bindParam() and Statement::exec() with params
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Rostislav Wolny
e1f38f3b83 Address offset issue in time comparison in AutomationEmailScheduler
[MAILPOET-6155]
2024-08-07 16:01:48 +02:00
Rostislav Wolny
0041a060b6 Improve check for recently scheduled tasks for sending action.
[MAILPOET-6155]
2024-08-07 16:01:48 +02:00
Rostislav Wolny
8a0bd75cb1 Limit scheduled tasks fetching by automation run createdAt
This is a performance optimization to avoid fetching too many scheduled task rows.
Run is always created before the scheduled task which is created in send action step.
[MAILPOET-6155]
2024-08-07 16:01:48 +02:00
Rostislav Wolny
e5ab65f28e Fix send action checkSendingStatus to support multiple emails per subscriber.
It is possible that one email (e.g., purchase in category) is sent multiple times
to the same subscriber.

AutomationEmailScheduler::getScheduledTaskSubscriber was selecting the task based on subscriber and newsletter.
In the case of multiple emails sent to one subscriber, the method failed to pick ScheduledTaskSubsrciberEntity because
the query was fetching multiple results, but getOneOrNullResult expects only one result.

This commit fixes it by adding additional filtering by $runId to get the ScheduledTaskSubsriberEntity associated
with the correct run.

I did the filtering in PHP because an alternative would be using LIKE %% in the query. The meta column is text.
[MAILPOET-6155]
2024-08-07 16:01:48 +02:00
Jan Lysý
26a98f1000 Update composer package doctrine/dbal
We cannot update to the latest version of the dbal 3 because there is a another package conflict.
[MAILPOET-6101]
2024-06-17 12:38:08 +02:00
Jan Jakes
123b0d65e2 Do not complete send email action run immediately, schedule a check instead
[MAILPOET-4977]
2024-05-06 12:39:00 +02:00
John Oleksowicz
f5aba4ebee Ensure invalid tasks don't prevent new post notifications
MAILPOET-5853
2024-01-29 17:16:12 +01:00
David Remer
f21ff46623 Do not schedule a post notification if the old status was publish
[MAILPOET-5822]
2024-01-15 00:17:45 +05:00
Jan Lysý
f1ffc77bf3 Set SendingQueue default counts for welcome emails
After performance optimization in Sending::updateCount() there was a bug when the min function set processed count back to zero.
[MAILPOET-5719]
2023-12-04 16:04:11 +01:00
Jan Lysý
941abc328a Set SendingQueue default counts for automatic emails
After performance optimization in Sending::updateCount() there was a bug when the min function set processed count back to zero.
[MAILPOET-5719]
2023-12-04 16:04:11 +01:00
Jan Jakes
45f5803293 Sync bulk deletes of scheduled task subscribers to entity manager
Fixes: https://github.com/mailpoet/mailpoet/issues/5281

[MAILPOET-5745]
2023-12-04 12:13:51 +01:00
Jan Jakes
2a1245bd8a Remove SendingQueueEntity::$subscribers
This doesn't seem to be used anywhere. For scheduled task subscribers, we have
ScheduledTaskEntity::$subscribers collection.

[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
b42d579b67 Remove usages of MailPoet\Tasks\Sending from welcome scheduler
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
09abbe2246 Remove usages of MailPoet\Tasks\Sending from automation email scheduler
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
457dab01fa Remove usages of MailPoet\Tasks\Sending from reengagement scheduler
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Rodrigo Primo
8fd8b8f193 Refactor Sending::setSubscribers() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
6a438f68d8 Remove duplicated method in ScheduledTaskSubscribersRepository
[MAILPOET-5422]
2023-06-23 16:59:32 +02:00
David Remer
50827706fb Add product_ids for abandoned cart to email
[MAILPOET-4934]
2023-05-15 08:19:19 +02:00
Jan Jakes
69f21814e3 Rename "transactional" email type to "automation_transactional"
[MAILPOET-5258]
2023-04-24 09:54:08 +03:00
Jan Lysý
4bcf413dbe Fix minute scheduling for post notifications
We recently added minute scheduling in UI, but we forgot to update PostNotificationScheduler.
It caused calculating float number for hours and PN were not scheduled.
[MAILPOET-5244]
2023-04-19 15:32:28 +02:00
David Remer
59bbe31433 Allow transactional emails
[MAILPOET-4999]
2023-04-17 13:59:39 +02: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
Jan Jakes
c67c58709b Unify spacing of declare statements
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
Rostislav Wolny
cd3652eaa6 Fix canceling multiple automatic emails
When we deleted sending queue using SQL it remained in the entity manager
and subsequent flush (not the first one) triggered the error, because it didn't know the ScheduledTask entity attached
to the orphaned SendingQueue entity.

This commit fixes this by refactoring deletion of sending queue using standard repository method.
After fixing the issue for sending queue there was another issue with SchedulesTaskSubscriberEntity that remained in memory.
I fixed that by detaching those. Theoretically there might be many SchedulesTaskSubscriberEntities for an Automatic email so
I consider still safer to delete using SQL and if there are some loaded (in this case there is one) detach them.
[MAILPOET-4741]
2022-10-24 14:03:54 +02:00
Jan Lysý
d2247a1c76 Refactor parameter from int to entity
[MAILPOET-4372]
2022-10-12 11:44:37 +02:00
Jan Lysý
c93c42518a Add return value for backward compatibility in tests
[MAILPOET-4372]
2022-10-12 11:44:37 +02:00
Jan Lysý
a1e96c63a0 Remove old model usages from AutomaticEmailScheduler
[MAILPOET-4372]
2022-10-12 11:44:37 +02:00
Jan Lysý
4deb137063 Rename method in repository
[MAILPOET-4685]
2022-09-29 15:19:09 -03:00
Sam Najian
873c295e99 Remove Paris models and Tasks\Sending from PostNotificationScheduler
[MAILPOET-4371]
2022-08-22 13:06:43 +02:00
David Remer
97e160bf67 Fix WordPress.WP.I18n.MissingArgDomain
[MAILPOET-4524]
2022-08-09 13:23:16 +02:00
David Remer
218de96024 Fix WordPress.WP.I18n.MissingTranslatorsComment errors
[MAILPOET-4524]
2022-08-09 13:23:16 +02:00
Jan Jakes
d7506fc8a4 Check email type in automation email scheduler
[MAILPOET-4465]
2022-07-12 13:36:58 +02:00
Jan Jakes
971da8a943 Add automation email scheduler service
[MAILPOET-4465]
2022-07-12 13:36:58 +02:00
Jan Lysý
586a5b8b8e Fix typo in const name
[MAILPOET-4440]
2022-07-12 13:35:00 +02:00
Jan Lysý
6503e49eda Add Newsletter entity support
[MAILPOET-4141]
2022-06-20 12:00:47 +02:00
Jan Lysý
4ba5c6ce0c Remove old model from Scheduler
[MAILPOET-4141]
2022-06-20 12:00:47 +02:00
Jan Lysý
5ab04b8b22 Remove usage constant from the old model
[MAILPOET-4338]
2022-05-19 14:18:06 +02:00
David Remer
7e43385040 Switch newRole and oldRole in array_diff to get correct difference
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
David Remer
9bd6f29870 Add add_user_role hook to synchronizeUser
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
David Remer
c34356b99c Remove optional $wp parameter in getScheduledTimeWithDelay method
[MAILPOET-4252]
2022-04-25 12:08:18 +02:00
David Remer
ca3f8bdc43 Make Scheduler non-static
[MAILPOET-4252]
2022-04-25 12:08:18 +02:00
Rostislav Wolny
9b71a7804c Update Monolog/Monolog from v1 to v2
[MAILPOET-4175]
2022-03-28 13:49:41 +02:00
Rostislav Wolny
ac0a9e7b6f Update doctrine/* libraries
[MAILPOET-4175]
2022-03-28 13:49:41 +02:00
John Oleksowicz
ec25f1aaf7 Add comment explaining optional callback
[MAILPOET-3518]
2022-02-09 16:33:06 +01:00