From: Michael Date: Sun, 3 Sep 2023 14:01:46 +0000 (+0000) Subject: Use language filtering on all channels, rearranged channels X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d3231c7a7d562ff3bb4ba355f4a9a984f2c484f4;hp=e5978d74c7fe3f8fee3b758eeb7572684cb70645;p=friendica.git Use language filtering on all channels, rearranged channels --- diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index 73eb009769..dfe8871f16 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -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();