summaryrefslogtreecommitdiffstats
path: root/ajax/markitem.php
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-07 21:52:41 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-07 21:52:41 -0400
commit4b154de4526d25fe810f1f371d9707789994e858 (patch)
tree77d17e41eb269a73550f263fce26ed12301fc183 /ajax/markitem.php
parent5754af967cb92c49ae90c544725eb5a9ed33fc59 (diff)
mark as read item working now
Diffstat (limited to 'ajax/markitem.php')
-rw-r--r--ajax/markitem.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/ajax/markitem.php b/ajax/markitem.php
index ea54d79e3..4d0a54fae 100644
--- a/ajax/markitem.php
+++ b/ajax/markitem.php
@@ -15,20 +15,21 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
-$itemid = trim($_POST['itemid']);
+$itemid = $_POST['itemid'];
$itemmapper = new OC_News_ItemMapper();
$item = $itemmapper->find($itemid);
-$feedid = $itemmapper->save($feed, 0);
+$item->setRead();
+$success = $itemmapper->update($item);
$l = OC_L10N::get('news');
-if(!$feedid) {
- OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.'))));
- OCP\Util::writeLog('news','ajax/newfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR);
+if(!$success) {
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error marking item as read.'))));
+ OCP\Util::writeLog('news','ajax/markitem.php: Error marking item as read: '.$_POST['itemid'], 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 added!'))));
+OCP\JSON::success(array('data' => array('message' => $l->t('Item updated!'))));