X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FRelay.php;h=e7e878a02d7e60634641fedf6ef66d89ec6c5617;hb=0ec7991a20eafe673e4e8bf77bd32c0f6d047a19;hp=e7ecea43f857d64573958ae2d415559ba501b39a;hpb=ec16e7c0e6349d7080f634177ef943b446be3735;p=friendica.git diff --git a/src/Protocol/Relay.php b/src/Protocol/Relay.php index e7ecea43f8..e7e878a02d 100644 --- a/src/Protocol/Relay.php +++ b/src/Protocol/Relay.php @@ -66,6 +66,11 @@ class Relay { $config = DI::config(); + if (Contact::hasFollowers($authorid)) { + Logger::info('Author has got followers on this server - accepted', ['network' => $network, 'url' => $url, 'author' => $authorid, 'tags' => $tags]); + return true; + } + $scope = $config->get('system', 'relay_scope'); if ($scope == self::SCOPE_NONE) { @@ -179,11 +184,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,13 +192,13 @@ 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); - if (is_null($user_languages)) { - $user_languages = User::getLanguages(); - DI::cache()->set($cachekey, $user_languages); - } + $user_languages = User::getLanguages(); foreach ($detected as $language) { if (in_array($language, $user_languages)) {