Use group posts for channels

This commit is contained in:
Michael 2023-09-02 06:38:05 +00:00
parent 3d6dae7774
commit 837c2dd24a
2 changed files with 2 additions and 7 deletions

View File

@ -65,11 +65,6 @@ class Engagement
return; 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')) { 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']]); Logger::debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
return; return;

View File

@ -236,12 +236,12 @@ class Channel extends BaseModule
protected static function getItems() protected static function getItems()
{ {
if (self::$content == self::WHATSHOT) { 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; $comments = $post[0]['comments'] ?? 0;
if (!is_null(self::$accountType)) { if (!is_null(self::$accountType)) {
$condition = ["`comments` >= ? AND `contact-type` = ?", $comments, self::$accountType]; $condition = ["`comments` >= ? AND `contact-type` = ?", $comments, self::$accountType];
} else { } else {
$condition = ["`comments` >= ?", $comments]; $condition = ["`comments` >= ? AND `contact-type` != ?", $comments, Contact::TYPE_COMMUNITY];
} }
} elseif (self::$content == self::FORYOU) { } elseif (self::$content == self::FORYOU) {
$cid = Contact::getPublicIdByUserId(DI::userSession()->getLocalUserId()); $cid = Contact::getPublicIdByUserId(DI::userSession()->getLocalUserId());