diff options
Diffstat (limited to 'ajax/deletefeed.php')
-rw-r--r-- | ajax/deletefeed.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/ajax/deletefeed.php b/ajax/deletefeed.php index b54620d48..a6f74f583 100644 --- a/ajax/deletefeed.php +++ b/ajax/deletefeed.php @@ -17,19 +17,17 @@ OCP\JSON::callCheck(); $userid = OCP\USER::getUser(); -$feedurl = trim($_POST['feedurl']); +$feedid = trim($_POST['feedid']); -$feed = OC_News_Utils::fetch($feedurl); $feedmapper = new OC_News_FeedMapper(); -$feedid = $feedmapper->save($feed, 0); +$success = $feedmapper->deleteById($feedid); $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 removing feed.')))); + OCP\Util::writeLog('news','ajax/deletefeed.php: Error removing 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 added!')))); +OCP\JSON::success(array('data' => array( 'feedid' => $feedid ))); |