]> git.mxchange.org Git - friendica.git/commitdiff
Fixes the score calculation concerning the relation-cid / cid interaction
authorMichael <heluecht@pirati.ca>
Thu, 7 Sep 2023 12:34:46 +0000 (12:34 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 23 Jun 2025 20:55:03 +0000 (22:55 +0200)
src/Module/Conversation/Channel.php
src/Worker/Cron.php

index 37d9b189852fc52c8b3796cdd9786b20e8a150ca..4f9480a48b455985276f429015e08097c8577ba0 100644 (file)
@@ -34,13 +34,39 @@ use Friendica\Network\HTTPException;
 use Friendica\Database\Database;
 use Friendica\Module\Response;
 use Friendica\Navigation\SystemMessages;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
 
 class Channel extends Timeline
 {
-       /** @var TimelineFactory */
-       protected $timeline;
+       const WHATSHOT  = 'whatshot';
+       const FORYOU    = 'foryou';
+       const FOLLOWERS = 'followers';
+       const SHARERSOFSHARERS = 'sharersofsharers';
+       const IMAGE     = 'image';
+       const VIDEO     = 'video';
+       const AUDIO     = 'audio';
+       const LANGUAGE  = 'language';
+
+       protected static $content;
+       protected static $accountTypeString;
+       protected static $accountType;
+       protected static $itemsPerPage;
+       protected static $min_id;
+       protected static $max_id;
+       protected static $item_id;
+
+       /** @var UserSession */
+       protected $session;
+       /** @var ICanCache */
+       protected $cache;
+       /** @var IManageConfigValues The config */
+       protected $config;
+       /** @var SystemMessages */
+       protected $systemMessages;
+       /** @var App\Page */
+       protected $page;
        /** @var Conversation */
        protected $conversation;
        /** @var App\Page */
@@ -89,10 +115,83 @@ class Channel extends Timeline
                        $o .= Renderer::replaceMacros($tpl, ['$reload_uri' => $this->args->getQueryString()]);
                }
 
-               if (!$this->raw) {
-                       $tabs = $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'channel');
-                       $tabs = array_merge($tabs, $this->getTabArray($this->channelRepository->selectByUid($this->session->getLocalUserId()), 'channel'));
-                       $tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel'));
+               if (empty($request['mode']) || ($request['mode'] != 'raw')) {
+                       $tabs = [];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('For you'),
+                               'url'       => 'channel/' . self::FORYOU,
+                               'sel'       => self::$content == self::FORYOU ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts from contacts you interact with and who interact with you'),
+                               'id'        => 'channel-foryou-tab',
+                               'accesskey' => 'y'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('What\'s Hot'),
+                               'url'       => 'channel/' . self::WHATSHOT,
+                               'sel'       => self::$content == self::WHATSHOT ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts with a lot of interactions'),
+                               'id'        => 'channel-whatshot-tab',
+                               'accesskey' => 'h'
+                       ];
+
+                       $language  = User::getLanguageCode($this->session->getLocalUserId());
+                       $languages = $this->l10n->getAvailableLanguages(true);
+
+                       $tabs[] = [
+                               'label'     => $languages[$language],
+                               'url'       => 'channel/' . self::LANGUAGE,
+                               'sel'       => self::$content == self::LANGUAGE ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts in %s', $languages[$language]),
+                               'id'        => 'channel-language-tab',
+                               'accesskey' => 'g'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('Followers'),
+                               'url'       => 'channel/' . self::FOLLOWERS,
+                               'sel'       => self::$content == self::FOLLOWERS ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts from your followers that you don\'t follow'),
+                               'id'        => 'channel-followers-tab',
+                               'accesskey' => 'f'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('Sharers of sharers'),
+                               'url'       => 'channel/' . self::SHARERSOFSHARERS,
+                               'sel'       => self::$content == self::SHARERSOFSHARERS ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts from accounts that are followed by accounts that you follow'),
+                               'id'        => 'channel-' . self::SHARERSOFSHARERS . '-tab',
+                               'accesskey' => 'f'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('Images'),
+                               'url'       => 'channel/' . self::IMAGE,
+                               'sel'       => self::$content == self::IMAGE ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts with images'),
+                               'id'        => 'channel-image-tab',
+                               'accesskey' => 'i'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('Audio'),
+                               'url'       => 'channel/' . self::AUDIO,
+                               'sel'       => self::$content == self::AUDIO ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts with audio'),
+                               'id'        => 'channel-audio-tab',
+                               'accesskey' => 'd'
+                       ];
+
+                       $tabs[] = [
+                               'label'     => $this->l10n->t('Videos'),
+                               'url'       => 'channel/' . self::VIDEO,
+                               'sel'       => self::$content == self::VIDEO ? 'active' : '',
+                               'title'     => $this->l10n->t('Posts with videos'),
+                               'id'        => 'channel-video-tab',
+                               'accesskey' => 'v'
+                       ];
 
                        $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
                        $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs, '$more' => $this->l10n->t('More')]);
index cf0529c8b4ce5a42cf980b11c30afb9bc9ea5a07..0702fd0f6f443b06d234a13aa6d697e2e413adea 100644 (file)
@@ -135,7 +135,7 @@ class Cron
                        DBA::close($users);
 
                        // Update contact relations for our users
-                       $users = DBA::select('user', ['uid'], ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]);
+                       $users = DBA::select('user', ['uid'], ["NOT `account_expired` AND NOT `account_removed` AND `uid` > ?", 0]);
                        while ($user = DBA::fetch($users)) {
                                Worker::add(Worker::PRIORITY_LOW, 'ContactDiscoveryForUser', $user['uid']);
                        }