Skip to content

A free, self-hostable news aggregator…

Ignore empty categories when sizing export feed selector (#9154)

Jam Balayae39b5898f18c
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 59221f3f5..1525da6f4 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -32,7 +32,10 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
* This action displays the main page for import / export system.
*/
public function indexAction(): void {
- $this->view->categories = $this->categoryDAO->listCategories();
+ $this->view->categories = array_filter(
+ $this->categoryDAO->listCategories(),
+ static fn(FreshRSS_Category $category): bool => !empty($category->feeds()),
+ );
$this->view->feedCount = array_sum(array_map(static fn(FreshRSS_Category $category): int => count($category->feeds()), $this->view->categories));
FreshRSS_View::prependTitle(_t('sub.import_export.title') . ' · ');
$this->listSqliteArchives();
diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml
index f0aa68b0b..ad3c39ba3 100644
--- a/app/views/importExport/index.phtml
+++ b/app/views/importExport/index.phtml
@@ -65,9 +65,6 @@
<?= extension_loaded('zip') ? '' : '<option></option>' ?>
<?php foreach ($this->categories as $category):
$feeds = $category->feeds();
- if (empty($feeds)) {
- continue;
- }
?>
<optgroup label="<?= $category->name() ?>">
<?php foreach ($feeds as $feed) { ?>