feat: derive autoresponder schedule from backend

This commit is contained in:
Marek Miklewicz
2026-06-02 19:55:07 +02:00
parent a0bd158a2e
commit f3abc7b33f
19 changed files with 248 additions and 43 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ return static function (AppContext $ctx): void {
$id = Http::isPost() ? $ctx->post('id') : $ctx->query('id');
$rule = $ctx->rules->find($ctx->daUser->username(), $id);
if ($rule === null) {
$ctx->render('Confirm deletion', '<div class="alert alert-err">Rule not found</div>');
$ctx->render('Confirm deletion', '<div class="alert alert-err">' . AppContext::e($ctx->t('Rule not found')) . '</div>');
return;
}
if (Http::isPost()) {
@@ -20,7 +20,7 @@ return static function (AppContext $ctx): void {
}
}
$body = '<div class="grid grid-2"><div class="panel"><h3>' . AppContext::e($ctx->t('Preview autoresponder')) . '</h3>' . render_preview_box($rule) . '</div>' .
'<div class="panel"><h3>' . AppContext::e($ctx->t('Confirm deletion')) . '</h3><div class="alert alert-err">Usunięcie reguły wyłączy odpowiedź automatyczną utworzoną przez tę regułę dla objętych skrzynek.</div>' .
'<div class="panel"><h3>' . AppContext::e($ctx->t('Confirm deletion')) . '</h3><div class="alert alert-err">' . AppContext::e($ctx->t('Deleting this rule will disable the automatic reply created by this rule for covered mailboxes.')) . '</div>' .
'<form method="post" action="' . AppContext::e($ctx->url('delete.html')) . '">' . $ctx->csrfField('delete:' . $id) . '<input type="hidden" name="id" value="' . AppContext::e($id) . '">' .
'<div class="actions"><button class="danger-fill" type="submit">' . AppContext::e($ctx->t('Delete autoresponder')) . '</button><a class="btn" href="' . AppContext::e($ctx->url('index.html')) . '">' . AppContext::e($ctx->t('Do not delete')) . '</a></div></form></div></div>';
$ctx->render('Confirm deletion', $body);