aboutsummaryrefslogtreecommitdiff
path: root/app/Models/CategoryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-12-27 16:26:02 +0100
committerGravatar GitHub <noreply@github.com> 2025-12-27 16:26:02 +0100
commit7c0370b4eacdd62c06c7324a39f092361e84a2bc (patch)
treeb7b96bde135dab5189728e668e8b6b03f2079ef4 /app/Models/CategoryDAO.php
parent40533684bb255264fec76296aed3ea4d35cd5317 (diff)
Do not include hidden feeds when counting unread articles in categories (#8357)
fix https://github.com/FreshRSS/FreshRSS/issues/8347
Diffstat (limited to 'app/Models/CategoryDAO.php')
-rw-r--r--app/Models/CategoryDAO.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index e03f69016..d98a2ffc1 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -410,9 +410,14 @@ SQL;
return isset($res[0]) ? (int)$res[0] : -1;
}
- public function countNotRead(int $id): int {
- $sql = 'SELECT COUNT(*) AS count FROM `_entry` e INNER JOIN `_feed` f ON e.id_feed=f.id WHERE category=:id AND e.is_read=0';
- $res = $this->fetchColumn($sql, 0, [':id' => $id]);
+ public function countNotRead(int $id, int $minPriority = FreshRSS_Feed::PRIORITY_CATEGORY): int {
+ $sql = <<<'SQL'
+ SELECT COUNT(*) AS count FROM `_entry` e
+ INNER JOIN `_feed` f ON e.id_feed=f.id
+ WHERE f.category=:id AND e.is_read=0
+ AND f.priority>=:minPriority
+ SQL;
+ $res = $this->fetchColumn($sql, 0, [':id' => $id, ':minPriority' => $minPriority]);
return isset($res[0]) ? (int)$res[0] : -1;
}