feat(automations): add run-now test endpoint and sends log table
Enable immediate automation test runs without waiting for the scheduled hour, expose send history for debugging, and return all SuperAdmin overlay keys on refresh instead of only enable_automation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,9 +21,9 @@ class AutomationSender
|
||||
) {
|
||||
}
|
||||
|
||||
public function send(Automation $auto, Customer $customer, string $channel): bool
|
||||
public function send(Automation $auto, Customer $customer, string $channel, bool $force = false): bool
|
||||
{
|
||||
if (! $this->maySend($auto, $customer, $channel)) {
|
||||
if (! $this->maySend($auto, $customer, $channel, $force)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,12 +71,16 @@ class AutomationSender
|
||||
}
|
||||
}
|
||||
|
||||
public function maySend(Automation $auto, Customer $customer, string $channel): bool
|
||||
public function maySend(Automation $auto, Customer $customer, string $channel, bool $force = false): bool
|
||||
{
|
||||
if (! $auto->usesChannel($channel)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($force) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$max = $auto->max_sends;
|
||||
if ($max !== null && (int) $max > 0) {
|
||||
$count = AutomationSend::query()
|
||||
|
||||
Reference in New Issue
Block a user