]> git.mxchange.org Git - friendica.git/commitdiff
Code clean up
authorMichael <heluecht@pirati.ca>
Wed, 10 Jan 2024 21:51:34 +0000 (21:51 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 28 Jan 2024 15:37:43 +0000 (16:37 +0100)
src/Content/Conversation/Repository/UserDefinedChannel.php

index 37e3ff06ff7af46607941d46dc7788054bf0c03b..e11a7d0abe019ec44e18b85c2ecf35405f851bc9 100644 (file)
@@ -217,11 +217,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository
                if (empty($users)) {
                        return [];
                }
-               return $this->getMatches($searchtext, $language, $tags, $media_type, $owner_id, $reshare_id, array_column($users, 'uid'), true);
-       }
 
-       private function getMatches(string $searchtext, string $language, array $tags, int $media_type, int $owner_id, int $reshare_id, array $channelUids, bool $relayMode): array
-       {
                if (!in_array($language, User::getLanguages())) {
                        $this->logger->debug('Unwanted language found. No matched channel found.', ['language' => $language, 'searchtext' => $searchtext]);
                        return [];
@@ -231,14 +227,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository
 
                $uids = [];
 
-               $condition = ['uid' => $channelUids, 'valid' => true];
-               if (!$relayMode) {
-                       $condition = DBA::mergeConditions($condition, ["`full-text-search` != ?", '']);
-               } else {
-                       $condition = DBA::mergeConditions($condition, ['publish' => true]);
-               }
-
-               foreach ($this->select($condition) as $channel) {
+               foreach ($this->select(['uid' => array_column($users, 'uid'), 'publish' => true, 'valid' => true]) as $channel) {
                        if (in_array($channel->uid, $uids)) {
                                continue;
                        }
@@ -276,9 +265,6 @@ class UserDefinedChannel extends \Friendica\BaseRepository
                        }
                        $uids[] = $channel->uid;
                        $this->logger->debug('Matching channel found.', ['uid' => $channel->uid, 'label' => $channel->label, 'language' => $language, 'tags' => $tags, 'media_type' => $media_type, 'searchtext' => $searchtext]);
-                       if (!$relayMode) {
-                               return $uids;
-                       }
                }
 
                $this->db->delete('check-full-text-search', ['pid' => getmypid()]);