Merge pull request #14046 from annando/channel-counter

Improvements for channel counter
This commit is contained in:
Hypolite Petovan 2024-03-27 11:15:44 -04:00 committed by GitHub
commit 31b74b1c8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 46 additions and 31 deletions

View File

@ -107,7 +107,7 @@ class Feature
DI::l10n()->t('General Features'), DI::l10n()->t('General Features'),
//array('expire', DI::l10n()->t('Content Expiration'), DI::l10n()->t('Remove old posts/comments after a period of time')), //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::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 // Post composition

View File

@ -309,7 +309,7 @@ class Network extends Timeline
$this->circleId = (int)($this->parameters['circle_id'] ?? 0); $this->circleId = (int)($this->parameters['circle_id'] ?? 0);
if (!$this->selectedTab) { 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)) { } 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.')); 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->dateTo = $this->parameters['to'] ?? '';
$this->setMaxMinByOrder($request); $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() protected function getItems()
@ -483,14 +488,24 @@ class Network extends Timeline
/** /**
* Returns the selected network tab of the currently logged-in user * Returns the selected network tab of the currently logged-in user
* *
* @param IHandleUserSessions $session
* @param IManagePersonalConfigValues $pconfig
* @return string * @return string
*/ */
public static function getTimelineOrderBySession(IHandleUserSessions $session, IManagePersonalConfigValues $pconfig): string private function getTimelineOrderBySession(): string
{ {
return $session->get('network-tab') return $this->session->get('network-tab')
?? $pconfig->get($session->getLocalUserId(), 'network.view', 'selected_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')
?? [];
}
} }

View File

@ -28,8 +28,12 @@ class Network extends NetworkModule
{ {
protected function rawContent(array $request = []) protected function rawContent(array $request = [])
{ {
if (!$this->session->getLocalUserId()) {
System::exit();
}
if (!empty($request['ping'])) { if (!empty($request['ping'])) {
$request = $this->session->get('network-request'); $request = $this->getTimelineRequestBySession();
} }
if (!isset($request['p']) || !isset($request['item'])) { if (!isset($request['p']) || !isset($request['item'])) {
@ -42,10 +46,6 @@ class Network extends NetworkModule
System::httpExit(''); System::httpExit('');
} }
if (empty($request['ping'])) {
$this->session->set('network-request', $request);
}
$this->itemsPerPage = 100; $this->itemsPerPage = 100;
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2024.06-dev\n" "Project-Id-Version: 2024.06-dev\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -2791,8 +2791,8 @@ msgstr ""
#: src/Core/Installer.php:516 #: src/Core/Installer.php:516
msgid "" msgid ""
"The web installer needs to be able to create a file called \"local.config." "The web installer needs to be able to create a file called \"local.config.php"
"php\" in the \"config\" folder of your web server and it is unable to do so." "\" in the \"config\" folder of your web server and it is unable to do so."
msgstr "" msgstr ""
#: src/Core/Installer.php:517 #: src/Core/Installer.php:517
@ -3952,8 +3952,8 @@ msgid ""
"profile\n" "profile\n"
"\t\t\t(on the \"Profiles\" page) so that other people can easily find you.\n" "\t\t\t(on the \"Profiles\" page) so that other people can easily find you.\n"
"\n" "\n"
"\t\t\tWe recommend adding a profile photo, adding some profile " "\t\t\tWe recommend adding a profile photo, adding some profile \"keywords"
"\"keywords\" (very useful\n" "\" (very useful\n"
"\t\t\tin making new friends) - and perhaps what country you live in; if you " "\t\t\tin making new friends) - and perhaps what country you live in; if you "
"do not wish\n" "do not wish\n"
"\t\t\tto be more specific than that.\n" "\t\t\tto be more specific than that.\n"
@ -5723,9 +5723,9 @@ msgstr ""
#: src/Module/Admin/Summary.php:98 #: src/Module/Admin/Summary.php:98
msgid "" msgid ""
"The last update failed. Please run \"php bin/console.php dbstructure " "The last update failed. Please run \"php bin/console.php dbstructure update"
"update\" from the command line and have a look at the errors that might " "\" from the command line and have a look at the errors that might appear. "
"appear. (Some of the errors are possibly inside the logfile.)" "(Some of the errors are possibly inside the logfile.)"
msgstr "" msgstr ""
#: src/Module/Admin/Summary.php:102 #: src/Module/Admin/Summary.php:102
@ -5876,8 +5876,8 @@ msgstr ""
#, php-format #, php-format
msgid "" msgid ""
"Show some informations regarding the needed information to operate the node " "Show some informations regarding the needed information to operate the node "
"according e.g. to <a href=\"%s\" target=\"_blank\" rel=\"noopener " "according e.g. to <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer"
"noreferrer\">EU-GDPR</a>." "\">EU-GDPR</a>."
msgstr "" msgstr ""
#: src/Module/Admin/Tos.php:81 #: src/Module/Admin/Tos.php:81
@ -9182,8 +9182,8 @@ msgstr ""
#: src/Module/Profile/Profile.php:158 #: src/Module/Profile/Profile.php:158
#, php-format #, php-format
msgid "" msgid ""
"You're currently viewing your profile as <b>%s</b> <a href=\"%s\" " "You're currently viewing your profile as <b>%s</b> <a href=\"%s\" class="
"class=\"btn btn-sm pull-right\">Cancel</a>" "\"btn btn-sm pull-right\">Cancel</a>"
msgstr "" msgstr ""
#: src/Module/Profile/Profile.php:167 #: src/Module/Profile/Profile.php:167
@ -9703,8 +9703,8 @@ msgstr ""
#: src/Module/Security/TwoFactor/Verify.php:100 #: src/Module/Security/TwoFactor/Verify.php:100
#, php-format #, php-format
msgid "" msgid ""
"If you do not have access to your authentication code you can use a <a " "If you do not have access to your authentication code you can use a <a href="
"href=\"%s\">two-factor recovery code</a>." "\"%s\">two-factor recovery code</a>."
msgstr "" msgstr ""
#: src/Module/Security/TwoFactor/Verify.php:101 #: src/Module/Security/TwoFactor/Verify.php:101
@ -11412,8 +11412,8 @@ msgstr ""
#: src/Module/Settings/TwoFactor/Verify.php:152 #: src/Module/Settings/TwoFactor/Verify.php:152
#, php-format #, php-format
msgid "" msgid ""
"<p>Or you can open the following URL in your mobile device:</p><p><a " "<p>Or you can open the following URL in your mobile device:</p><p><a href="
"href=\"%s\">%s</a></p>" "\"%s\">%s</a></p>"
msgstr "" msgstr ""
#: src/Module/Settings/TwoFactor/Verify.php:159 #: src/Module/Settings/TwoFactor/Verify.php:159
@ -11522,9 +11522,9 @@ msgstr ""
msgid "" msgid ""
"At any point in time a logged in user can export their account data from the " "At any point in time a logged in user can export their account data from the "
"<a href=\"%1$s/settings/userexport\">account settings</a>. If the user wants " "<a href=\"%1$s/settings/userexport\">account settings</a>. If the user wants "
"to delete their account they can do so at <a href=\"%1$s/settings/" "to delete their account they can do so at <a href=\"%1$s/settings/removeme\">"
"removeme\">%1$s/settings/removeme</a>. The deletion of the account will be " "%1$s/settings/removeme</a>. The deletion of the account will be permanent. "
"permanent. Deletion of the data will also be requested from the nodes of the " "Deletion of the data will also be requested from the nodes of the "
"communication partners." "communication partners."
msgstr "" msgstr ""