diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-01 01:45:00 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-01 01:45:00 +0200 |
commit | 42f4244d44b35d172715dc7e70b6f3bd55d08005 (patch) | |
tree | 358f4f366aeb2a6c3df43ceff9809b37806c1dc4 /ajax | |
parent | 4c39312cb3ffba28b103e49ac37f293fc5eea78b (diff) |
mark all read works now
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); } |