From 45dc42692f983356d635715da6e1a8adc628ad6e Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Mon, 25 Sep 2023 00:37:55 -0400 Subject: [PATCH] print_err only when spamnoticer didn't succeed (reduce noise) --- inc/spamnoticer.php | 6 +++--- post.php | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/inc/spamnoticer.php b/inc/spamnoticer.php index 38aa7ad8..802f7c75 100644 --- a/inc/spamnoticer.php +++ b/inc/spamnoticer.php @@ -271,9 +271,6 @@ function checkWithSpamNoticer($config, $post, $boardname) { $status_code = $response->getStatusCode(); - print_err("spamnoticer status code: " . $status_code); - print_err("spamnoticer response body: " . $response->getBody()); - if ($status_code >= 200 && $status_code < 300) { $result->succeeded = true; $result->result_json = json_decode($response->getBody(), true); @@ -286,6 +283,9 @@ function checkWithSpamNoticer($config, $post, $boardname) { $result->reason = renderReasons($reasons_bitmap); } } else { + print_err("spamnoticer status code: " . $status_code); + print_err("spamnoticer response body: " . $response->getBody()); + $result->reason = (string) $response->getBody(); } diff --git a/post.php b/post.php index a560de6c..039818ec 100644 --- a/post.php +++ b/post.php @@ -982,12 +982,8 @@ function handle_post(){ $spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']); - if ($spam_noticer_result->succeeded) { - if ($spam_noticer_result->noticed) { - error($config['error']['spam_noticer'] . $spam_noticer_result->reason); - } - } else { - print_err($spam_noticer_result->reason); + if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) { + error($config['error']['spam_noticer'] . $spam_noticer_result->reason); } }