From: Michael Date: Sat, 2 Sep 2023 06:38:05 +0000 (+0000) Subject: Use group posts for channels X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=837c2dd24ae4b43b22c1ee0539e8c770e6b030d5;p=friendica.git Use group posts for channels --- diff --git a/src/Model/Post/Engagement.php b/src/Model/Post/Engagement.php index 8c9ce1537a..55c5b3ba1c 100644 --- a/src/Model/Post/Engagement.php +++ b/src/Model/Post/Engagement.php @@ -65,11 +65,6 @@ class Engagement return; } - if ($parent['contact-contact-type'] == Contact::TYPE_COMMUNITY) { - Logger::debug('Group posts are not stored', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'author-id' => $parent['author-id']]); - return; - } - if ($parent['created'] < DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' hour')) { Logger::debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]); return; diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index 3bb8b60397..972c8891a5 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -236,12 +236,12 @@ class Channel extends BaseModule protected static function getItems() { if (self::$content == self::WHATSHOT) { - $post = DBA::selectToArray('post-engagement', ['comments'], [], ['order' => ['comments' => true], 'limit' => [DI::config()->get('channel', 'hot_posts_item_limit'), 1]]); + $post = DBA::selectToArray('post-engagement', ['comments'], ["`contact-type` != ?", Contact::TYPE_COMMUNITY], ['order' => ['comments' => true], 'limit' => [DI::config()->get('channel', 'hot_posts_item_limit'), 1]]); $comments = $post[0]['comments'] ?? 0; if (!is_null(self::$accountType)) { $condition = ["`comments` >= ? AND `contact-type` = ?", $comments, self::$accountType]; } else { - $condition = ["`comments` >= ?", $comments]; + $condition = ["`comments` >= ? AND `contact-type` != ?", $comments, Contact::TYPE_COMMUNITY]; } } elseif (self::$content == self::FORYOU) { $cid = Contact::getPublicIdByUserId(DI::userSession()->getLocalUserId());