diff --git a/admin/class-settings-page.php b/admin/class-settings-page.php index aded85d..d6a1886 100644 --- a/admin/class-settings-page.php +++ b/admin/class-settings-page.php @@ -16,6 +16,8 @@ final class Settings_Page add_action('admin_post_cf7stg_retro', [$this, 'handle_retro']); add_action('admin_post_cf7stg_retry_failed', [$this, 'handle_retry_failed']); add_action('admin_post_cf7stg_purge_sent', [$this, 'handle_purge_sent']); + add_action('admin_post_cf7stg_save_drop', [$this, 'handle_save_drop']); + add_action('admin_post_cf7stg_reset_drop_counters', [$this, 'handle_reset_drop_counters']); } public function add_menu(): void @@ -92,6 +94,23 @@ final class Settings_Page $this->redirect_back(['purged' => $n]); } + public function handle_save_drop(): void + { + $this->guard('cf7stg_save_drop'); + Settings::set_dry_run_drop(!empty($_POST['dry_run_drop'])); + Settings::set_hard_drop_enabled(!empty($_POST['hard_drop_enabled'])); + $threshold = (int)($_POST['drop_score_threshold'] ?? -5); + Settings::set_drop_score_threshold($threshold); + $this->redirect_back(['drop_saved' => 1]); + } + + public function handle_reset_drop_counters(): void + { + $this->guard('cf7stg_reset_drop_counters'); + Settings::reset_drop_counters(); + $this->redirect_back(['drop_reset' => 1]); + } + private function guard(string $action): void { if (!current_user_can('manage_options')) wp_die('forbidden'); diff --git a/admin/views/settings.php b/admin/views/settings.php index 409e857..d536d53 100644 --- a/admin/views/settings.php +++ b/admin/views/settings.php @@ -13,6 +13,8 @@ if (($_GET['test'] ?? '') === 'err') $notice = '
Добавлено в очередь: ' . (int)$_GET['retro_added'] . ', пропущено: ' . (int)$_GET['retro_skipped'] . '.
Перезапущено с ошибкой: ' . (int)$_GET['retried'] . '.
Удалено отправленных: ' . (int)$_GET['purged'] . '.
Настройки silent drop сохранены.
Счётчики silent drop сброшены.
+ Заявки, удовлетворяющие правилам, не отправляются в Telegram.
+ Подробности правил — в docs/superpowers/specs/2026-04-21-cf7stg-silent-drop-design.md.
+
+ Всего дропнуто:
+ Сегодня (real): · сегодня (dry-run):
+ Вчера (real): · вчера (dry-run):
+ Счётчик с:
+