]> git.mxchange.org Git - friendica.git/commitdiff
Configuration is now stored in the "channel" section
authorMichael <heluecht@pirati.ca>
Fri, 1 Sep 2023 22:28:25 +0000 (22:28 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 1 Sep 2023 22:28:25 +0000 (22:28 +0000)
src/Model/Contact/Relation.php
src/Model/Post/Engagement.php
src/Module/Conversation/Channel.php

index 94b5f63ffd423e9ec7424a68ad21acca2532a17b..a8d093bc727a9169028daf98085478d05f20dce5 100644 (file)
@@ -781,7 +781,7 @@ class Relation
         */
        public static function calculateInteractionScore(int $uid)
        {
-               $days = DI::config()->get('system', 'interaction_score_days');
+               $days = DI::config()->get('channel', 'interaction_score_days');
                $contact_id = Contact::getPublicIdByUserId($uid);
 
                Logger::debug('Calculation - start', ['uid' => $uid, 'cid' => $contact_id, 'days' => $days]);
index 84d106b7abe4654b774fb3eddf33a893189eda8e..2d1f40b6ce5e3b9cebb7a3ccace8d45550113d4b 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
 use Friendica\Model\Post;
@@ -69,7 +70,7 @@ class Engagement
                        return;
                }
 
-               if ($parent['created'] < DateTimeFormat::utc('now - 1 day')) {
+               if ($parent['created'] < DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' 24 hour')) {
                        Logger::debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
                        return;
                }
@@ -92,7 +93,7 @@ class Engagement
 
        public static function expire()
        {
-               DBA::delete('post-engagement', ["`created` < ?", DateTimeFormat::utc('now - 1 day')]);
+               DBA::delete('post-engagement', ["`created` < ?", DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' 24 hour')]);
                Logger::notice('Cleared expired engagements', ['rows' => DBA::affectedRows()]);
        }
 }
index 5881cafdaa90f2ea54ba224f24208459e81c0c22..3503a96d46d680361c65e847b8c2592d991fa8d4 100644 (file)
@@ -237,9 +237,8 @@ class Channel extends BaseModule
         */
        protected static function getItems()
        {
-               $post = DBA::selectToArray('post-engagement', ['comments'], [], ['order' => ['comments' => true], 'limit' => [100, 1]]);
-
                if (self::$content == self::WHATSHOT) {
+                       $post     = DBA::selectToArray('post-engagement', ['comments'], [], ['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];