feat: complete production backend integration

This commit is contained in:
Marek Miklewicz
2026-06-02 20:51:57 +02:00
parent d3f2fd69db
commit 4b531a4c24
20 changed files with 853 additions and 40 deletions
+21
View File
@@ -48,6 +48,9 @@ final class GlobalAutoresponderWorker
if (!$this->isActiveRule($rule)) {
continue;
}
if (!$this->ruleIncludesRecipient($rule, $recipient)) {
continue;
}
$ruleId = (string)($rule['id'] ?? '');
if ($ruleId === '') {
continue;
@@ -81,6 +84,24 @@ final class GlobalAutoresponderWorker
return (int)($rule['start_ts'] ?? 0) <= $now && (int)($rule['end_ts'] ?? 0) >= $now;
}
/** @param array<string,mixed> $rule */
private function ruleIncludesRecipient(array $rule, string $recipient): bool
{
if (!array_key_exists('dynamic_scope', $rule) || !empty($rule['dynamic_scope'])) {
return true;
}
$snapshot = $rule['mailbox_snapshot'] ?? [];
if (!is_array($snapshot)) {
return false;
}
foreach ($snapshot as $mailbox) {
if (is_array($mailbox) && strtolower((string)($mailbox['email'] ?? '')) === strtolower($recipient)) {
return true;
}
}
return false;
}
/** @param array<string,string> $env @param string[] $keys */
private static function firstEnv(array $env, array $keys): string
{