mirror of
https://github.com/friendica/friendica
synced 2024-11-10 03:02:54 +00:00
Use owner instead of author
This commit is contained in:
parent
4aedf7f650
commit
6cd0e1e35f
2 changed files with 9 additions and 8 deletions
|
@ -180,20 +180,21 @@ class UserDefinedChannel extends \Friendica\BaseRepository
|
||||||
*
|
*
|
||||||
* @param string $searchtext
|
* @param string $searchtext
|
||||||
* @param string $language
|
* @param string $language
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param integer $media_type
|
* @param int $media_type
|
||||||
|
* @param int $owner_id
|
||||||
* @return array
|
* @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]);
|
$users = $this->db->selectToArray('user', ['uid'], ["`account-type` = ? AND `uid` != ?", User::ACCOUNT_TYPE_RELAY, 0]);
|
||||||
if (empty($users)) {
|
if (empty($users)) {
|
||||||
return [];
|
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())) {
|
if (!in_array($language, User::getLanguages())) {
|
||||||
$this->logger->debug('Unwanted language found. No matched channel found.', ['language' => $language, 'searchtext' => $searchtext]);
|
$this->logger->debug('Unwanted language found. No matched channel found.', ['language' => $language, 'searchtext' => $searchtext]);
|
||||||
|
@ -214,7 +215,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!empty($channel->circle) && ($channel->circle > 0) && !in_array($channel->uid, $uids)) {
|
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']])) {
|
if (empty($account['id']) || !$this->db->exists('group_member', ['gid' => $channel->circle, 'contact-id' => $account['id']])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1452,7 +1452,7 @@ class Item
|
||||||
|
|
||||||
private static function reshareChannelPost(int $uri_id)
|
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'])) {
|
if (empty($item['id'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1469,7 +1469,7 @@ class Item
|
||||||
$language = !empty($item['language']) ? array_key_first(json_decode($item['language'], true)) : '';
|
$language = !empty($item['language']) ? array_key_first(json_decode($item['language'], true)) : '';
|
||||||
$tags = array_column(Tag::getByURIId($uri_id, [Tag::HASHTAG]), 'name');
|
$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']]);
|
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);
|
self::performActivity($item['id'], 'announce', $uid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue