]> git.mxchange.org Git - friendica.git/commitdiff
Update function / rearrange tab order
authorMichael <heluecht@pirati.ca>
Sat, 2 Sep 2023 05:22:44 +0000 (05:22 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 2 Sep 2023 05:22:44 +0000 (05:22 +0000)
doc/Accesskeys.md
src/Model/Post/Engagement.php
src/Module/Conversation/Channel.php
update.php

index 255c7f65ca622880f10629d6ff1c894683b40f74..df9629dc506fc679d2c854fad04c8ac58310743a 100644 (file)
@@ -31,9 +31,9 @@ General
 
 ../channel
 --------
-* h - what's hot
 * y - for you
 * f - followers
+* h - what's hot
 
 ../profile
 --------
index 48ce024d4984cb2d30220def89f39d303448a096..8c9ce1537a17f07815ccd6e8b7e313bcd871a1f0 100644 (file)
@@ -87,6 +87,10 @@ class Engagement
                                Verb::getID(Activity::FOLLOW), Verb::getID(Activity::VIEW), Verb::getID(Activity::READ)
                        ])
                ];
+               if (($engagement['comments'] == 0) && ($engagement['activities'] == 0)) {
+                       Logger::debug('No comments nor activities. Engagement not stored', ['fields' => $engagement]);
+                       return;
+               }
                $ret = DBA::insert('post-engagement', $engagement, Database::INSERT_UPDATE);
                Logger::debug('Engagement stored', ['fields' => $engagement, 'ret' => $ret]);
        }
index a6c20ef3d817b9e87f5aef01ed7214f90b8f13e6..d6f3088feee92f2d163648782cca40886b637db8 100644 (file)
@@ -78,15 +78,6 @@ class Channel extends BaseModule
                if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
                        $tabs = [];
 
-                       $tabs[] = [
-                               'label'     => DI::l10n()->t('Whats Hot'),
-                               'url'       => 'channel/' . self::WHATSHOT,
-                               'sel'       => self::$content == self::WHATSHOT ? 'active' : '',
-                               'title'     => DI::l10n()->t('Posts with a lot of interactions'),
-                               'id'        => 'channel-whatshot-tab',
-                               'accesskey' => 'h'
-                       ];
-
                        $tabs[] = [
                                'label'     => DI::l10n()->t('For you'),
                                'url'       => 'channel/' . self::FORYOU,
@@ -104,6 +95,15 @@ class Channel extends BaseModule
                                'id'        => 'channel-followers-tab',
                                'accesskey' => 'f'
                        ];
+                       
+                       $tabs[] = [
+                               'label'     => DI::l10n()->t('Whats Hot'),
+                               'url'       => 'channel/' . self::WHATSHOT,
+                               'sel'       => self::$content == self::WHATSHOT ? 'active' : '',
+                               'title'     => DI::l10n()->t('Posts with a lot of interactions'),
+                               'id'        => 'channel-whatshot-tab',
+                               'accesskey' => 'h'
+                       ];
 
                        $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
                        $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
@@ -189,7 +189,7 @@ class Channel extends BaseModule
 
                self::$content = $this->parameters['content'] ?? '';
                if (!self::$content) {
-                       self::$content = self::WHATSHOT;
+                       self::$content = self::FORYOU;
                }
 
                if (!in_array(self::$content, [self::WHATSHOT, self::FORYOU, self::FOLLOWERS])) {
index 59340eed83c84dfe7281048e7145d5f61964b2a8..9af01fd0fe36fbe2d460f30ad590ef19ea52a1eb 100644 (file)
@@ -62,6 +62,7 @@ use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Protocol\Delivery;
 use Friendica\Security\PermissionSet\Repository\PermissionSet;
+use Friendica\Util\DateTimeFormat;
 
 // Post-update script of PR 5751
 function update_1298()
@@ -1377,3 +1378,15 @@ function update_1525(): int
 
        return Update::SUCCESS;
 }
+
+function update_1531()
+{
+       $threads = Post::selectThread(Item::DELIVER_FIELDLIST, ["`uid` = ? AND `created` > ?", 0, DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' hour')]);
+       while ($post = Post::fetch($threads)) {
+               $post['gravity'] = Item::GRAVITY_COMMENT;
+               Post\Engagement::storeFromItem($post);
+       }
+       DBA::close($threads);
+
+       return Update::SUCCESS;
+}
\ No newline at end of file