From 0fde21ff288ed4bd2fc2196389b950f994d01005 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 25 Mar 2024 07:20:41 +0000 Subject: [PATCH] Improvements for channel counter --- src/Content/Feature.php | 2 +- src/Module/Conversation/Network.php | 27 +++++++++++++++----- src/Module/Ping/Network.php | 10 ++++---- view/lang/C/messages.po | 38 ++++++++++++++--------------- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/src/Content/Feature.php b/src/Content/Feature.php index 84a32f5ed5..282d8928fd 100644 --- a/src/Content/Feature.php +++ b/src/Content/Feature.php @@ -107,7 +107,7 @@ class Feature DI::l10n()->t('General Features'), //array('expire', DI::l10n()->t('Content Expiration'), DI::l10n()->t('Remove old posts/comments after a period of time')), [self::PHOTO_LOCATION, DI::l10n()->t('Photo Location'), DI::l10n()->t("Photo metadata is normally stripped. This extracts the location \x28if present\x29 prior to stripping metadata and links it to a map."), false, DI::config()->get('feature_lock', self::PHOTO_LOCATION, false)], - [self::COMMUNITY, DI::l10n()->t('Display the community in the navigation'), DI::l10n()->t('If enabled, the community can be accessed via the navigation menu. Independant from this setting, the community timelines can always be accessed via the channels.'), true, DI::config()->get('feature_lock', self::COMMUNITY, false)], + [self::COMMUNITY, DI::l10n()->t('Display the community in the navigation'), DI::l10n()->t('If enabled, the community can be accessed via the navigation menu. Independent from this setting, the community timelines can always be accessed via the channels.'), true, DI::config()->get('feature_lock', self::COMMUNITY, false)], ], // Post composition diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 94b1bc77f6..806f958a0d 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -309,7 +309,7 @@ class Network extends Timeline $this->circleId = (int)($this->parameters['circle_id'] ?? 0); if (!$this->selectedTab) { - $this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig); + $this->selectedTab = $this->getTimelineOrderBySession(); } elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) { throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.')); } @@ -371,6 +371,11 @@ class Network extends Timeline $this->dateTo = $this->parameters['to'] ?? ''; $this->setMaxMinByOrder($request); + + if (is_null($this->maxId) && !is_null($this->minId)) { + $this->session->set('network-request', $request); + $this->pConfig->set($this->session->getLocalUserId(), 'network.view', 'request', $request); + } } protected function getItems() @@ -483,14 +488,24 @@ class Network extends Timeline /** * Returns the selected network tab of the currently logged-in user * - * @param IHandleUserSessions $session - * @param IManagePersonalConfigValues $pconfig * @return string */ - public static function getTimelineOrderBySession(IHandleUserSessions $session, IManagePersonalConfigValues $pconfig): string + private function getTimelineOrderBySession(): string { - return $session->get('network-tab') - ?? $pconfig->get($session->getLocalUserId(), 'network.view', 'selected_tab') + return $this->session->get('network-tab') + ?? $this->pConfig->get($this->session->getLocalUserId(), 'network.view', 'selected_tab') ?? ''; } + + /** + * Returns the lst request parameters of the currently logged-in user + * + * @return array + */ + protected function getTimelineRequestBySession(): array + { + return $this->session->get('network-request') + ?? $this->pConfig->get($this->session->getLocalUserId(), 'network.view', 'request') + ?? []; + } } diff --git a/src/Module/Ping/Network.php b/src/Module/Ping/Network.php index 09ae7b2b44..9eec3b366a 100644 --- a/src/Module/Ping/Network.php +++ b/src/Module/Ping/Network.php @@ -28,8 +28,12 @@ class Network extends NetworkModule { protected function rawContent(array $request = []) { + if (!$this->session->getLocalUserId()) { + System::exit(); + } + if (!empty($request['ping'])) { - $request = $this->session->get('network-request'); + $request = $this->getTimelineRequestBySession(); } if (!isset($request['p']) || !isset($request['item'])) { @@ -42,10 +46,6 @@ class Network extends NetworkModule System::httpExit(''); } - if (empty($request['ping'])) { - $this->session->set('network-request', $request); - } - $this->itemsPerPage = 100; if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index e61bfe50f5..c2817a6199 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2024.06-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 18:34+0100\n" +"POT-Creation-Date: 2024-03-27 11:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2791,8 +2791,8 @@ msgstr "" #: src/Core/Installer.php:516 msgid "" -"The web installer needs to be able to create a file called \"local.config." -"php\" in the \"config\" folder of your web server and it is unable to do so." +"The web installer needs to be able to create a file called \"local.config.php" +"\" in the \"config\" folder of your web server and it is unable to do so." msgstr "" #: src/Core/Installer.php:517 @@ -3952,8 +3952,8 @@ msgid "" "profile\n" "\t\t\t(on the \"Profiles\" page) so that other people can easily find you.\n" "\n" -"\t\t\tWe recommend adding a profile photo, adding some profile " -"\"keywords\" (very useful\n" +"\t\t\tWe recommend adding a profile photo, adding some profile \"keywords" +"\" (very useful\n" "\t\t\tin making new friends) - and perhaps what country you live in; if you " "do not wish\n" "\t\t\tto be more specific than that.\n" @@ -5723,9 +5723,9 @@ msgstr "" #: src/Module/Admin/Summary.php:98 msgid "" -"The last update failed. Please run \"php bin/console.php dbstructure " -"update\" from the command line and have a look at the errors that might " -"appear. (Some of the errors are possibly inside the logfile.)" +"The last update failed. Please run \"php bin/console.php dbstructure update" +"\" from the command line and have a look at the errors that might appear. " +"(Some of the errors are possibly inside the logfile.)" msgstr "" #: src/Module/Admin/Summary.php:102 @@ -5876,8 +5876,8 @@ msgstr "" #, php-format msgid "" "Show some informations regarding the needed information to operate the node " -"according e.g. to EU-GDPR." +"according e.g. to EU-GDPR." msgstr "" #: src/Module/Admin/Tos.php:81 @@ -9182,8 +9182,8 @@ msgstr "" #: src/Module/Profile/Profile.php:158 #, php-format msgid "" -"You're currently viewing your profile as %s Cancel" +"You're currently viewing your profile as %s Cancel" msgstr "" #: src/Module/Profile/Profile.php:167 @@ -9703,8 +9703,8 @@ msgstr "" #: src/Module/Security/TwoFactor/Verify.php:100 #, php-format msgid "" -"If you do not have access to your authentication code you can use a two-factor recovery code." +"If you do not have access to your authentication code you can use a two-factor recovery code." msgstr "" #: src/Module/Security/TwoFactor/Verify.php:101 @@ -11412,8 +11412,8 @@ msgstr "" #: src/Module/Settings/TwoFactor/Verify.php:152 #, php-format msgid "" -"

Or you can open the following URL in your mobile device:

%s

" +"

Or you can open the following URL in your mobile device:

%s

" msgstr "" #: src/Module/Settings/TwoFactor/Verify.php:159 @@ -11522,9 +11522,9 @@ msgstr "" msgid "" "At any point in time a logged in user can export their account data from the " "account settings. If the user wants " -"to delete their account they can do so at %1$s/settings/removeme. The deletion of the account will be " -"permanent. Deletion of the data will also be requested from the nodes of the " +"to delete their account they can do so at " +"%1$s/settings/removeme. The deletion of the account will be permanent. " +"Deletion of the data will also be requested from the nodes of the " "communication partners." msgstr ""