print_err only when spamnoticer didn't succeed (reduce noise)

This commit is contained in:
towards-a-new-leftypol 2023-09-25 00:37:55 -04:00
parent 237b4ff1c7
commit 45dc42692f
2 changed files with 5 additions and 9 deletions

View File

@ -271,9 +271,6 @@ function checkWithSpamNoticer($config, $post, $boardname) {
$status_code = $response->getStatusCode(); $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) { if ($status_code >= 200 && $status_code < 300) {
$result->succeeded = true; $result->succeeded = true;
$result->result_json = json_decode($response->getBody(), true); $result->result_json = json_decode($response->getBody(), true);
@ -286,6 +283,9 @@ function checkWithSpamNoticer($config, $post, $boardname) {
$result->reason = renderReasons($reasons_bitmap); $result->reason = renderReasons($reasons_bitmap);
} }
} else { } else {
print_err("spamnoticer status code: " . $status_code);
print_err("spamnoticer response body: " . $response->getBody());
$result->reason = (string) $response->getBody(); $result->reason = (string) $response->getBody();
} }

View File

@ -982,12 +982,8 @@ function handle_post(){
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']); $spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
if ($spam_noticer_result->succeeded) { if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
if ($spam_noticer_result->noticed) { error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
} else {
print_err($spam_noticer_result->reason);
} }
} }