diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-20 19:17:39 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-20 19:17:53 +0200 |
commit | 7492639549bbf67d89ccb41aa68416cacafaae7d (patch) | |
tree | 6fc85ed523cdde5c52d4d5a81beb1de65c7c8044 /ajax | |
parent | 5ead2af71798670854217888ba178ba7861f2989 (diff) |
setting items as read has now an immediate response from the server about how many feeds are unread and the ui updates nearly immediately
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 b24d62262..f6d206e20 100644 --- a/ajax/setallitemsread.php +++ b/ajax/setallitemsread.php @@ -44,11 +44,14 @@ $success = false; if($mostRecentItemId !== 0) { $mostRecentItem = $itemMapper->findById($mostRecentItemId); } + +$unreadCount = count($items); foreach($items as $item) { // FIXME: this should compare the modified date if($mostRecentItemId === 0 || $item->getDate() <= $mostRecentItem->getDate()) { $item->setRead(); - $success = $itemMapper->update($item); + $success = $itemMapper->update($item); + $unreadCount--; } } @@ -63,4 +66,4 @@ if(!$success) { } //TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations -OCP\JSON::success(array('data' => array('feedId' => $feedId ))); +OCP\JSON::success(array('data' => array('feedId' => $feedId, 'unreadCount' => $unreadCount))); |