feat: use vacation subject prefix

This commit is contained in:
Marek Miklewicz
2026-06-02 21:28:31 +02:00
parent 64b62a5793
commit 56709817b5
18 changed files with 220 additions and 68 deletions
+13 -6
View File
@@ -5,7 +5,7 @@ require_once PLUGIN_ROOT . '/scripts/global_autoresponder_worker.php';
test('exim worker sends active rule for resolved mailbox only', function (): void {
$settingsPath = TEST_TMP . '/worker-settings.conf';
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\nGLOBAL_AUTORESPONDER_REPEAT_MINUTES=60\n");
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\n");
$settings = Settings::load($settingsPath);
$virtualRoot = TEST_TMP . '/worker-virtual';
@@ -15,6 +15,9 @@ test('exim worker sends active rule for resolved mailbox only', function (): voi
$repo = new RuleRepository(TEST_TMP . '/worker-data');
$created = $repo->create('alice', [
'subject' => 'Urlop',
'subject_prefix' => 'Urlop',
'reply_every_message' => false,
'repeat_minutes' => 60,
'body' => 'Odpowiem później',
'start_ts' => 900,
'end_ts' => 1100,
@@ -42,7 +45,7 @@ test('exim worker sends active rule for resolved mailbox only', function (): voi
assert_same(1, $count);
assert_same('info@example.com', $sent[0]['from']);
assert_same('person@example.net', $sent[0]['to']);
assert_same('Urlop', $sent[0]['subject']);
assert_same('Urlop: hello', $sent[0]['subject']);
assert_same('Odpowiem później', $sent[0]['body']);
$count = $worker->handle(
@@ -56,7 +59,7 @@ test('exim worker sends active rule for resolved mailbox only', function (): voi
test('exim worker suppresses automated messages and ignores unresolved recipients', function (): void {
$settingsPath = TEST_TMP . '/worker-suppress-settings.conf';
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\nGLOBAL_AUTORESPONDER_REPLY_EVERY_MESSAGE=true\n");
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\n");
$settings = Settings::load($settingsPath);
$virtualRoot = TEST_TMP . '/worker-suppress-virtual';
@@ -66,7 +69,9 @@ test('exim worker suppresses automated messages and ignores unresolved recipient
$repo = new RuleRepository(TEST_TMP . '/worker-suppress-data');
$repo->create('alice', [
'subject' => 'Urlop',
'subject_prefix' => 'Urlop',
'reply_every_message' => true,
'repeat_minutes' => 0,
'body' => 'Body',
'start_ts' => 1,
'end_ts' => 2000,
@@ -99,7 +104,7 @@ test('exim worker suppresses automated messages and ignores unresolved recipient
test('exim worker respects static mailbox snapshot scope', function (): void {
$settingsPath = TEST_TMP . '/worker-snapshot-settings.conf';
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\nGLOBAL_AUTORESPONDER_REPLY_EVERY_MESSAGE=true\n");
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\n");
$settings = Settings::load($settingsPath);
$virtualRoot = TEST_TMP . '/worker-snapshot-virtual';
@@ -108,7 +113,9 @@ test('exim worker respects static mailbox snapshot scope', function (): void {
$repo = new RuleRepository(TEST_TMP . '/worker-snapshot-data');
$repo->create('alice', [
'subject' => 'Urlop',
'subject_prefix' => 'Urlop',
'reply_every_message' => true,
'repeat_minutes' => 0,
'body' => 'Body',
'start_ts' => 1,
'end_ts' => 2000,