From 6cd0e1e35f320417cd44446455b7571974ae061c Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 7 Jan 2024 01:08:59 +0000 Subject: [PATCH] Use owner instead of author --- .../Conversation/Repository/UserDefinedChannel.php | 13 +++++++------ src/Model/Item.php | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Content/Conversation/Repository/UserDefinedChannel.php b/src/Content/Conversation/Repository/UserDefinedChannel.php index 6572eda140..60784c1f08 100644 --- a/src/Content/Conversation/Repository/UserDefinedChannel.php +++ b/src/Content/Conversation/Repository/UserDefinedChannel.php @@ -180,20 +180,21 @@ class UserDefinedChannel extends \Friendica\BaseRepository * * @param string $searchtext * @param string $language - * @param array $tags - * @param integer $media_type + * @param array $tags + * @param int $media_type + * @param int $owner_id * @return array */ - public function getMatchingChannelUsers(string $searchtext, string $language, array $tags, int $media_type, int $author_id): array + public function getMatchingChannelUsers(string $searchtext, string $language, array $tags, int $media_type, int $owner_id): array { $users = $this->db->selectToArray('user', ['uid'], ["`account-type` = ? AND `uid` != ?", User::ACCOUNT_TYPE_RELAY, 0]); if (empty($users)) { return []; } - return $this->getMatches($searchtext, $language, $tags, $media_type, $author_id, array_column($users, 'uid'), true); + return $this->getMatches($searchtext, $language, $tags, $media_type, $owner_id, array_column($users, 'uid'), true); } - private function getMatches(string $searchtext, string $language, array $tags, int $media_type, int $author_id, array $channelUids, bool $relayMode): array + private function getMatches(string $searchtext, string $language, array $tags, int $media_type, int $owner_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]); @@ -214,7 +215,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository continue; } if (!empty($channel->circle) && ($channel->circle > 0) && !in_array($channel->uid, $uids)) { - $account = Contact::selectFirstAccountUser(['id'], ['pid' => $author_id, 'uid' => $channel->uid]); + $account = Contact::selectFirstAccountUser(['id'], ['pid' => $owner_id, 'uid' => $channel->uid]); if (empty($account['id']) || !$this->db->exists('group_member', ['gid' => $channel->circle, 'contact-id' => $account['id']])) { continue; } diff --git a/src/Model/Item.php b/src/Model/Item.php index 33cf61d61f..cd6e32fcbb 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1452,7 +1452,7 @@ class Item private static function reshareChannelPost(int $uri_id) { - $item = Post::selectFirst(['id', 'private', 'network', 'language', 'author-id'], ['uri-id' => $uri_id, 'uid' => 0]); + $item = Post::selectFirst(['id', 'private', 'network', 'language', 'owner-id'], ['uri-id' => $uri_id, 'uid' => 0]); if (empty($item['id'])) { return; } @@ -1469,7 +1469,7 @@ class Item $language = !empty($item['language']) ? array_key_first(json_decode($item['language'], true)) : ''; $tags = array_column(Tag::getByURIId($uri_id, [Tag::HASHTAG]), 'name'); - foreach (DI::userDefinedChannel()->getMatchingChannelUsers($engagement['searchtext'], $language, $tags, $engagement['media-type'], $item['author-id']) as $uid) { + foreach (DI::userDefinedChannel()->getMatchingChannelUsers($engagement['searchtext'], $language, $tags, $engagement['media-type'], $item['owner-id']) as $uid) { Logger::debug('Reshare post', ['uid' => $uid, 'uri-id' => $uri_id, 'language' => $language, 'tags' => $tags, 'searchtext' => $engagement['searchtext'], 'media_type' => $engagement['media-type']]); self::performActivity($item['id'], 'announce', $uid); }