Commit Graph

7 Commits

Author SHA1 Message Date
Osama Sayegh
9ebf7c9c37
FIX: Preveint recurring automations from running before start_date (#26963)
Some combinations of start_date and frequency/interval values can cause a recurring automation rule to either trigger before its start_date or never trigger. Example repros:

- Configure a recurring automation with hourly recurrence and a start_date several days ahead. What this will do is make the automation start running hourly immediately even though the start_date is several days ahead.

-  Configure a recurring automation with a weekly recurrence and a start_date several weeks ahead. This will result in the automation never triggering even after the start_date.

These 2 scenarios share the same cause which is that the automation plugin doesn't use the start_date as the date for the first run and instead uses the frequency/interval values from the current time to calculate the first run date.

This PR fixes this bug by adding an explicit check for start_date and using it as the first run's date if it's ahead of the current time.
2024-05-10 11:45:23 +10:00
Osama Sayegh
2f2355b0ad
DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
Joffrey JAFFEUX
e7f0aa52fa
FIX: ensures we don't exit without pending automations (#26771)
This case is not supposed to happen but it seems safer to ensure this case will recreate pending automations.
2024-04-26 14:05:27 +02:00
Joffrey JAFFEUX
bf715c8235
FIX: resets pending automations only if necessary (#26685)
Prior to this fix, any change to an automation would reset `pending_automations`, now we only do it if any value related to recurrence (start_date, interval, frequency, execute_at...) has been changed.

It means that any trigger creating `pending_automations` now needs to manage them in the `on_update` callback.
2024-04-19 14:23:57 +02:00
Osama Sayegh
4733369f71
FEATURE: Add 'New users only' option to user_updated trigger (#26648)
This commit adds a new option to the `user_updated` trigger of the automation plugin to only trigger an automation for new users that join after the automation is enabled.

Internal topic: t/125829/9.
2024-04-16 21:13:11 +03:00
Osama Sayegh
84b4e4bddf
FEATURE: Add 'Create topic' automation script (#26552)
This commit adds a new automation script for creating topics. It's very similar to the existing 'create a post' automation, except that it posts new topics in a specific category and with optional tags.

Internal topic: t/125829.
2024-04-09 04:21:31 +03:00
Osama Sayegh
3d4faf3272
FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
2024-04-03 18:20:43 +03:00