summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-08-16 12:56:17 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-08-16 12:56:17 +0200
commit2ba25ab970f9430116b55578aa9cef6ce157db88 (patch)
tree868a95ece8bd7da1029beb2e30b99fc8a11431e7 /ajax
parent6dcf152409c21f883e3082068bab75dc10a7fa39 (diff)
set only non displayed items as read
Diffstat (limited to 'ajax')
-rw-r--r--ajax/setallitemsread.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/ajax/setallitemsread.php b/ajax/setallitemsread.php
index 2d2ccead5..c5b589481 100644
--- a/ajax/setallitemsread.php
+++ b/ajax/setallitemsread.php
@@ -16,6 +16,7 @@ OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$feedId = $_POST['feedId'];
+$mostRecentItemId = $_POST['mostRecentItemId'];
$itemMapper = new OCA\News\ItemMapper();
$items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD);
@@ -24,8 +25,10 @@ $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD);
// FeedMapper instead of iterating through every item and updating as
// necessary
foreach($items as $item){
- $item->setRead();
- $success = $itemMapper->update($item);
+ if($item->getId() <= $mostRecentItemId){
+ $item->setRead();
+ $success = $itemMapper->update($item);
+ }
}
$l = OC_L10N::get('news');