mirror of
https://github.com/friendica/friendica
synced 2025-04-28 07:44:23 +02:00
Moved empty post detection
This commit is contained in:
parent
f5091110c2
commit
5b2b73da92
2 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue