From 837c2dd24ae4b43b22c1ee0539e8c770e6b030d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 2 Sep 2023 06:38:05 +0000 Subject: [PATCH] Use group posts for channels --- src/Model/Post/Engagement.php | 5 ----- src/Module/Conversation/Channel.php | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) 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()); -- 2.39.5