From: Michael Date: Sun, 5 Nov 2023 23:05:33 +0000 (+0000) Subject: Moved empty post detection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5b2b73da92ca91128fd5d657eb0342b71b4d4da3;p=friendica.git Moved empty post detection --- diff --git a/src/Protocol/Relay.php b/src/Protocol/Relay.php index e7ecea43f8..7d62ba576e 100644 --- a/src/Protocol/Relay.php +++ b/src/Protocol/Relay.php @@ -179,11 +179,6 @@ class Relay */ public static function isWantedLanguage(string $body, int $uri_id = 0, int $author_id = 0, array $languages = []) { - if (empty($languages) && (empty($body) || Smilies::isEmojiPost($body))) { - Logger::debug('Empty body or only emojis', ['body' => $body]); - return true; - } - $detected = []; $quality = DI::config()->get('system', 'relay_language_quality'); foreach (Item::getLanguageArray($body, DI::config()->get('system', 'relay_languages'), $uri_id, $author_id) as $language => $reliability) { @@ -192,6 +187,11 @@ class Relay } } + if (empty($languages) && empty($detected) && (empty($body) || Smilies::isEmojiPost($body))) { + Logger::debug('Empty body or only emojis', ['body' => $body]); + return true; + } + if (!empty($languages) || !empty($detected)) { $cachekey = 'relay:isWantedLanguage'; $user_languages = DI::cache()->get($cachekey); diff --git a/static/defaults.config.php b/static/defaults.config.php index dbc11235f2..3f6971dfa0 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -562,8 +562,8 @@ return [ // Deny undetected languages 'relay_deny_undetected_language' => false, - // relay_language_quality (Integer) - // Minimum value for the language detection quality for relay posts. The value must be betweeen 0 and 1. + // relay_language_quality (Float) + // Minimum value for the language detection quality for relay posts. The value must be between 0 and 1. 'relay_language_quality' => 0, // relay_languages (Integer)