Automatic simplification of layout for many feeds (#4357)

* Refactor OPML export categories
Simplify code to comply with types hints.
And renamed a property to plural.

* Automatic simplification of layout for many feeds
New advanced property to automatically simplify the layout when there are many (1k+)  feeds so that FreshRSS works out of the box with 20k+ feeds scenarios https://github.com/FreshRSS/FreshRSS/pull/4347

Merge https://github.com/FreshRSS/FreshRSS/pull/4356 first.
pull/4370/head
Alexandre Alapetite 2 years ago committed by GitHub
parent 5736ec67c4
commit 0cde4e898f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/Models/UserConfiguration.php
  2. 13
      app/layout/aside_feed.phtml
  3. 2
      config-user.default.php

@ -40,6 +40,7 @@
* @property bool $show_fav_unread * @property bool $show_fav_unread
* @property bool $show_favicons * @property bool $show_favicons
* @property bool $icons_as_emojis * @property bool $icons_as_emojis
* @property int $simplify_over_n_feeds
* @property bool $show_nav_buttons * @property bool $show_nav_buttons
* @property string $sort_order * @property string $sort_order
* @property array<string,array<string>> $sharing * @property array<string,array<string>> $sharing

@ -71,6 +71,11 @@
</li> </li>
<?php <?php
$nbFeedsTotal = 0;
foreach ($this->categories as $cat) {
$nbFeedsTotal += $cat->nbFeeds();
}
foreach ($this->categories as $cat): foreach ($this->categories as $cat):
$feeds = $cat->feeds(); $feeds = $cat->feeds();
$position = $cat->attributes('position'); $position = $cat->attributes('position');
@ -95,12 +100,14 @@
?> ?>
<li id="f_<?= $feed->id() ?>" class="item feed<?= $f_active ? ' active' : '', $feed->mute() ? ' mute' : '' ?><?= <li id="f_<?= $feed->id() ?>" class="item feed<?= $f_active ? ' active' : '', $feed->mute() ? ' mute' : '' ?><?=
$feed->inError() ? ' error' : '' ?><?= $feed->nbEntries() <= 0 ? ' empty' : '' $feed->inError() ? ' error' : '' ?><?= $feed->nbEntries() <= 0 ? ' empty' : ''
?>" data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>"> ?>" data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>"><?php
<div class="dropdown no-mobile"> if ($f_active || $nbFeedsTotal < FreshRSS_Context::$user_conf->simplify_over_n_feeds):
?><div class="dropdown no-mobile">
<div class="dropdown-target"></div><a class="dropdown-toggle" data-fweb="<?= $feed->website() ?>"><?= _i('configure') ?></a><?php /* feed_config_template */ ?> <div class="dropdown-target"></div><a class="dropdown-toggle" data-fweb="<?= $feed->website() ?>"><?= _i('configure') ?></a><?php /* feed_config_template */ ?>
</div> </div>
<?php <?php
if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; if (FreshRSS_Context::$user_conf->show_favicons) { ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php }
endif;
?><a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= ?><a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?=
_url('index', $actual_view, 'get', 'f_' . $feed->id()) . $state_filter_manual ?>"><?= $feed->name() ?></a></li> _url('index', $actual_view, 'get', 'f_' . $feed->id()) . $state_filter_manual ?>"><?= $feed->name() ?></a></li>
<?php <?php

@ -86,6 +86,8 @@ return array (
# Disabling favicons and using emojis instead of icons improves performance for users with many feeds # Disabling favicons and using emojis instead of icons improves performance for users with many feeds
'show_favicons' => true, 'show_favicons' => true,
'icons_as_emojis' => false, 'icons_as_emojis' => false,
# Hide the dropdown configuration menu and favicon in the aside list in case of many feeds, for UI performance
'simplify_over_n_feeds' => 1000,
'topline_read' => true, 'topline_read' => true,
'topline_favorite' => true, 'topline_favorite' => true,

Loading…
Cancel
Save