fix: simplify autoresponder list actions

This commit is contained in:
Marek Miklewicz
2026-06-03 15:31:03 +02:00
parent 9174d62706
commit 196ee224fe
5 changed files with 24 additions and 9 deletions
+2 -4
View File
@@ -12,8 +12,7 @@ return static function (AppContext $ctx): void {
if ($rules === []) { if ($rules === []) {
$body = '<div class="panel"><div class="empty-state"><div><h3>' . AppContext::e($ctx->t('No global autoresponders')) . '</h3>' . $body = '<div class="panel"><div class="empty-state"><div><h3>' . AppContext::e($ctx->t('No global autoresponders')) . '</h3>' .
'<p class="muted">' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '</p>' . '<p class="muted">' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '</p></div></div></div>';
'<a class="btn amber" href="' . AppContext::e($ctx->url('create.html')) . '">' . AppContext::e($ctx->t('Add autoresponder')) . '</a></div></div></div>';
$ctx->render('Global autoresponders', $body, $ok); $ctx->render('Global autoresponders', $body, $ok);
return; return;
} }
@@ -35,7 +34,6 @@ return static function (AppContext $ctx): void {
} }
$body = '<div class="panel"><div class="panel-head"><div><h3>' . AppContext::e($ctx->t('Global autoresponders')) . '</h3><p class="muted">' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '</p></div>' . $body = '<div class="panel"><div class="panel-head"><div><h3>' . AppContext::e($ctx->t('Global autoresponders')) . '</h3><p class="muted">' . AppContext::e($ctx->t('All valid POP/IMAP mailboxes in this account')) . '</p></div>' .
'<a class="btn amber" href="' . AppContext::e($ctx->url('create.html')) . '">' . AppContext::e($ctx->t('Add autoresponder')) . '</a></div>' . '</div><table><thead><tr><th>' . AppContext::e($ctx->t('Status')) . '</th><th>' . AppContext::e($ctx->t('Subject prefix')) . '</th><th>' . AppContext::e($ctx->t('Sending period')) . '</th><th>' . AppContext::e($ctx->t('Actions')) . '</th></tr></thead><tbody>' . $rows . '</tbody></table></div>';
'<table><thead><tr><th>' . AppContext::e($ctx->t('Status')) . '</th><th>' . AppContext::e($ctx->t('Subject prefix')) . '</th><th>' . AppContext::e($ctx->t('Sending period')) . '</th><th>' . AppContext::e($ctx->t('Actions')) . '</th></tr></thead><tbody>' . $rows . '</tbody></table></div>';
$ctx->render('Global autoresponders', $body, $ok); $ctx->render('Global autoresponders', $body, $ok);
}; };
+2 -2
View File
@@ -5,8 +5,8 @@ return [
'Global autoresponders' => 'Global autoresponders', 'Global autoresponders' => 'Global autoresponders',
'Manage automatic replies for account mailboxes' => 'Manage automatic replies for account mailboxes', 'Manage automatic replies for account mailboxes' => 'Manage automatic replies for account mailboxes',
'Dashboard' => 'Dashboard', 'Dashboard' => 'Dashboard',
'AUTORESPONDERS' => 'AUTORESPONDERS', 'AUTORESPONDERS' => 'Global autoresponder list',
'ADD AUTORESPONDER' => 'ADD AUTORESPONDER', 'ADD AUTORESPONDER' => 'Add global autoresponder',
'Add autoresponder' => 'Add autoresponder', 'Add autoresponder' => 'Add autoresponder',
'Edit autoresponder' => 'Edit autoresponder', 'Edit autoresponder' => 'Edit autoresponder',
'Preview autoresponder' => 'Preview autoresponder', 'Preview autoresponder' => 'Preview autoresponder',
+2 -2
View File
@@ -5,8 +5,8 @@ return [
'Global autoresponders' => 'Globalne autorespondery', 'Global autoresponders' => 'Globalne autorespondery',
'Manage automatic replies for account mailboxes' => 'Zarządzanie odpowiedziami dla skrzynek pocztowych konta', 'Manage automatic replies for account mailboxes' => 'Zarządzanie odpowiedziami dla skrzynek pocztowych konta',
'Dashboard' => 'Pulpit', 'Dashboard' => 'Pulpit',
'AUTORESPONDERS' => 'AUTORESPONDERY', 'AUTORESPONDERS' => 'Lista globalnych autoresponderów',
'ADD AUTORESPONDER' => 'DODAJ AUTORESPONDER', 'ADD AUTORESPONDER' => 'Dodaj Globalny autoresponder',
'Add autoresponder' => 'Dodaj autoresponder', 'Add autoresponder' => 'Dodaj autoresponder',
'Edit autoresponder' => 'Edytuj autoresponder', 'Edit autoresponder' => 'Edytuj autoresponder',
'Preview autoresponder' => 'Podgląd autorespondera', 'Preview autoresponder' => 'Podgląd autorespondera',
+1 -1
View File
@@ -2,7 +2,7 @@ name=global-autoresponder
id=global-autoresponder id=global-autoresponder
type=user type=user
author=HITME.PL author=HITME.PL
version=1.1.5 version=1.2.1
active=no active=no
installed=no installed=no
user_run_as=root user_run_as=root
+17
View File
@@ -29,6 +29,23 @@ test('directadmin user hooks are clickable and point to reserved icon path', fun
assert_contains('Globalne autorespondery', $txt); assert_contains('Globalne autorespondery', $txt);
}); });
test('top navigation uses global autoresponder labels', function (): void {
$pl = require PLUGIN_ROOT . '/lang/pl.php';
$en = require PLUGIN_ROOT . '/lang/en.php';
assert_same('Lista globalnych autoresponderów', $pl['AUTORESPONDERS'] ?? '');
assert_same('Dodaj Globalny autoresponder', $pl['ADD AUTORESPONDER'] ?? '');
assert_same('Global autoresponder list', $en['AUTORESPONDERS'] ?? '');
assert_same('Add global autoresponder', $en['ADD AUTORESPONDER'] ?? '');
});
test('autoresponder index keeps add button only in top navigation', function (): void {
$source = file_get_contents(PLUGIN_ROOT . '/exec/handlers/index.php') ?: '';
assert_false(strpos($source, "ctx->url('create.html')") !== false);
assert_false(strpos($source, "ctx->t('Add autoresponder')") !== false);
});
test('rule form uses minute time input and no summary box in exim mode', function (): void { test('rule form uses minute time input and no summary box in exim mode', function (): void {
require_once PLUGIN_ROOT . '/exec/lib/Settings.php'; require_once PLUGIN_ROOT . '/exec/lib/Settings.php';
require_once PLUGIN_ROOT . '/exec/lib/Lang.php'; require_once PLUGIN_ROOT . '/exec/lib/Lang.php';