Przeglądaj źródła

Bug "mark all as read" when using DESC and pagination and no scroll

https://github.com/marienfressinaud/FreshRSS/issues/431#issuecomment-35774488
Alexandre Alapetite 12 lat temu
rodzic
commit
7313f9f3a3
2 zmienionych plików z 5 dodań i 6 usunięć
  1. 3 3
      app/Models/EntryDAO.php
  2. 2 3
      app/layout/nav_menu.phtml

+ 3 - 3
app/Models/EntryDAO.php

@@ -65,7 +65,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 	public function markReadEntries ($idMax = 0, $favorites = false) {
-		if ($idMax === 0) {
+		if ($idMax == 0) {
 			$sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
 			     . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
 			     . 'WHERE e.is_read = 0 AND ';
@@ -127,7 +127,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 	public function markReadCat ($id, $idMax = 0) {
-		if ($idMax === 0) {
+		if ($idMax == 0) {
 			$sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
 			     . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
 			     . 'WHERE f.category = ? AND e.is_read = 0';
@@ -182,7 +182,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 		}
 	}
 	public function markReadFeed ($id, $idMax = 0) {
-		if ($idMax === 0) {
+		if ($idMax == 0) {
 			$sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '
 			     . 'SET e.is_read = 1, f.cache_nbUnreads=0 '
 			     . 'WHERE f.id=? AND e.is_read = 0';

+ 2 - 3
app/layout/nav_menu.phtml

@@ -62,12 +62,11 @@
 			}
 		}
 		if ($this->order === 'ASC') {
-			$nb = count($this->entries) - 1;
-			$p = ($nb >= 0 && isset($this->entries[$nb])) ? $this->entries[$nb] : null;
+			$idMax = 0;
 		} else {
 			$p = isset($this->entries[0]) ? $this->entries[0] : null;
+			$idMax = $p === null ? '0' : $p->id();
 		}
-		$idMax = $p === null ? '0' : $p->id();
 
 		$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
 		$output = Minz_Request::param('output', '');