summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-24 19:54:46 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-09-24 19:54:46 +0200
commit6a812b0d31df275d9b8b211a90628400ee097644 (patch)
tree77b2056802c77c5ab3f187baf7362746dbadd92b
parentd6b4186040011aad16a173a1ceaa5a5084025470 (diff)
API rename feed
-rwxr-xr-xapp/Controllers/feedController.php12
-rw-r--r--p/api/greader.php19
2 files changed, 21 insertions, 10 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 0ff27e0da..0364424f5 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -492,6 +492,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
return $updated_feeds;
}
+ public static function renameFeed($feed_id, $feed_name) {
+ if ($feed_id <= 0 || $feed_name == '') {
+ return false;
+ }
+ $feedDAO = FreshRSS_Factory::createFeedDao();
+ return $feedDAO->updateFeed($feed_id, array('name' => $feed_name));
+ }
+
public static function moveFeed($feed_id, $cat_id) {
if ($feed_id <= 0) {
return false;
@@ -504,9 +512,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$cat_id = $def_cat->id();
}
$feedDAO = FreshRSS_Factory::createFeedDao();
- $feed = $feedDAO->searchById($feed_id);
- return $feed && ($feed->category() == $cat_id ||
- $feedDAO->updateFeed($feed_id, array('category' => $cat_id)));
+ return $feedDAO->updateFeed($feed_id, array('category' => $cat_id));
}
/**
diff --git a/p/api/greader.php b/p/api/greader.php
index 9b07e0729..131eb65c5 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -325,27 +325,32 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '
case 'subscribe':
if ($feedId <= 0) {
//TODO
+ notImplemented();
} else {
badRequest();
}
break;
case 'unsubscribe':
- if ($feedId > 0 && FreshRSS_feed_Controller::deleteFeed($feedId)) {
- exit('OK');
- } else {
+ if (!($feedId > 0 && FreshRSS_feed_Controller::deleteFeed($feedId))) {
badRequest();
}
break;
case 'edit':
- if ($feedId > 0 && FreshRSS_feed_Controller::moveFeed($feedId, $addCatId)) {
- exit('OK');
+ if ($feedId > 0) {
+ if ($addCatId > 0) {
+ FreshRSS_feed_Controller::moveFeed($feedId, $addCatId);
+ }
+ if ($title != '') {
+ FreshRSS_feed_Controller::renameFeed($feedId, $title);
+ }
+ } else {
+ badRequest();
}
- badRequest();
break;
}
}
}
- notImplemented();
+ exit('OK');
}
function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count