summaryrefslogtreecommitdiffstats
path: root/ajax/updatefeed.php
diff options
context:
space:
mode:
Diffstat (limited to 'ajax/updatefeed.php')
-rw-r--r--ajax/updatefeed.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/ajax/updatefeed.php b/ajax/updatefeed.php
index bc74324e3..f503d9e91 100644
--- a/ajax/updatefeed.php
+++ b/ajax/updatefeed.php
@@ -33,7 +33,16 @@ if(!$newfeedid) {
OCP\Util::writeLog('news','ajax/updatefeed.php: Error updating feed: '.$_POST['feedid'], OCP\Util::ERROR);
exit();
}
-
-//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations
-OCP\JSON::success(array('data' => array('message' => $l->t('Feed updated!'))));
-
+else {
+ //TODO: maybe make this more efficient by coding it into OC_News_FeedMapper->save()
+ $itemmapper = new OC_News_ItemMapper();
+ $items = $itemmapper->findAll($newfeedid);
+ $unreadcounter = 0;
+ foreach($items as $item) {
+ if(!$item->isRead())
+ ++$unreadcounter;
+ }
+
+ OCP\JSON::success(array('data' => array('message' => $l->t('Feed updated!'), 'unreadcount' => $unreadcounter)));
+ exit();
+}