aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/indexController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controllers/indexController.php')
-rwxr-xr-xapp/Controllers/indexController.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 04b26d686..c760e0f01 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -84,6 +84,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
// On récupère les différents éléments de filtrage
$this->view->state = $state = Minz_Request::param ('state', $this->view->conf->default_view);
+ $state_param = Minz_Request::param ('state', null);
$filter = Minz_Request::param ('search', '');
if (!empty($filter)) {
$state = 'all'; //Search always in read and unread articles
@@ -111,6 +112,9 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$hasUnread = true;
break;
}
+ if (!$hasUnread && is_null($state_param)) {
+ $this->view->state = $state = 'all';
+ }
}
$today = @strtotime('today');
@@ -124,6 +128,14 @@ class FreshRSS_index_Controller extends Minz_ActionController {
try {
$entries = $entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min, $keepHistoryDefault);
+ // Si on a récupéré aucun article "non lus"
+ // on essaye de récupérer tous les articles
+ if ($state === 'not_read' && empty($entries) && is_null($state_param)) {
+ Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG);
+ $this->view->state = 'all';
+ $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault);
+ }
+
if (count($entries) <= $nb) {
$this->view->nextId = '';
} else { //We have more elements for pagination