]> git.mxchange.org Git - friendica.git/commitdiff
Use language filtering on all channels, rearranged channels
authorMichael <heluecht@pirati.ca>
Sun, 3 Sep 2023 14:01:46 +0000 (14:01 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 3 Sep 2023 14:01:46 +0000 (14:01 +0000)
src/Module/Conversation/Channel.php

index 73eb00976942604ed3f6b6f87f7e69f1d4baae45..dfe8871f162b4e0a707e2ca3e7bbb54739ad873f 100644 (file)
@@ -135,15 +135,6 @@ class Channel extends BaseModule
                                'accesskey' => 'y'
                        ];
 
-                       $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('What\'s Hot'),
                                'url'       => 'channel/' . self::WHATSHOT,
@@ -153,6 +144,27 @@ class Channel extends BaseModule
                                'accesskey' => 'h'
                        ];
 
+                       $language  = User::getLanguageCode($this->session->getLocalUserId(), false);
+                       $languages = $this->l10n->getAvailableLanguages();
+
+                       $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('Images'),
                                'url'       => 'channel/' . self::IMAGE,
@@ -162,15 +174,6 @@ class Channel extends BaseModule
                                'accesskey' => 'i'
                        ];
 
-                       $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'
-                       ];
-
                        $tabs[] = [
                                'label'     => $this->l10n->t('Audio'),
                                'url'       => 'channel/' . self::AUDIO,
@@ -180,16 +183,13 @@ class Channel extends BaseModule
                                'accesskey' => 'd'
                        ];
 
-                       $language  = User::getLanguageCode($this->session->getLocalUserId(), false);
-                       $languages = $this->l10n->getAvailableLanguages();
-
                        $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'
+                               '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');
@@ -327,8 +327,6 @@ class Channel extends BaseModule
                        } else {
                                $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ?", $this->getMedianComments(4), $this->getMedianActivities(4), Contact::TYPE_COMMUNITY];
                        }
-
-                       $condition = $this->addLanguageCondition($condition);
                } elseif (self::$content == self::FORYOU) {
                        $cid = Contact::getPublicIdByUserId($this->session->getLocalUserId());
 
@@ -349,6 +347,10 @@ class Channel extends BaseModule
                        $condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", User::getLanguageCode($this->session->getLocalUserId(), true)];
                }
 
+               if (self::$content != self::LANGUAGE) {
+                       $condition = $this->addLanguageCondition($condition);
+               }
+
                $condition[0] .= " AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed`))";
                $condition[] = $this->session->getLocalUserId();