Posts without text or only with emojis are now always accepted in the language check

This commit is contained in:
Michael 2023-08-28 15:37:20 +00:00
parent 5f832cb75a
commit 4dbb7dd3da
3 changed files with 21 additions and 6 deletions

View file

@ -21,6 +21,7 @@
namespace Friendica\Protocol;
use Friendica\Content\Smilies;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
@ -157,6 +158,11 @@ class Relay
*/
public static function isWantedLanguage(string $body)
{
if (empty($body) || Smilies::isEmojiPost($body)) {
Logger::debug('Empty body or only emojis', ['body' => $body]);
return true;
}
$languages = [];
foreach (Item::getLanguageArray($body, 10) as $language => $reliability) {
if ($reliability > 0) {