feat: complete production backend integration
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user