From 42f4244d44b35d172715dc7e70b6f3bd55d08005 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 1 Sep 2012 01:45:00 +0200 Subject: mark all read works now --- ajax/setallitemsread.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ajax') 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); } -- cgit v1.2.3