diff options
Diffstat (limited to 'ajax')
-rw-r--r-- | ajax/setallitemsread.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ajax/setallitemsread.php b/ajax/setallitemsread.php index d352b2aa3..aee0ff008 100644 --- a/ajax/setallitemsread.php +++ b/ajax/setallitemsread.php @@ -19,7 +19,7 @@ $feedId = $_POST['feedId']; $mostRecentItemId = (int)$_POST['mostRecentItemId']; $itemMapper = new OCA\News\ItemMapper(); -$mostRecentItem = $itemMapper->find($mostRecentItemId); + //echo $mostRecentItem->getDate(); switch ($feedId) { case -2: @@ -40,9 +40,12 @@ switch ($feedId) { // FeedMapper instead of iterating through every item and updating as // necessary $success = false; +if($mostRecentItemId !== 0){ + $mostRecentItem = $itemMapper->find($mostRecentItemId); +} foreach($items as $item){ // FIXME: this should compare the modified date - if($item->getDate() <= $mostRecentItem->getDate()){ + if($mostRecentItemId === 0 || $item->getDate() <= $mostRecentItem->getDate()){ $item->setRead(); $success = $itemMapper->update($item); } |