diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 14:25:05 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 14:25:42 +0100 |
commit | b250747c6681dca656b0761f70f53d0295d228d1 (patch) | |
tree | 906be611568fa4c958600697e4c93d825240fcd8 /controller | |
parent | 00c4eeb67905f481e4d50e81237873956120c7c5 (diff) |
fix #882
Diffstat (limited to 'controller')
-rw-r--r-- | controller/feedcontroller.php | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index c36c6da10..8fa9504f4 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -293,51 +293,29 @@ class FeedController extends Controller { return []; } - - /** - * @NoAdminRequired - * - * @param int $feedId - * @param int $ordering - */ - public function ordering($feedId, $ordering) { - try { - $this->feedService->setOrdering($feedId, $ordering, $this->userId); - } catch(ServiceNotFoundException $ex) { - return $this->error($ex, Http::STATUS_NOT_FOUND); - } - - return []; - } - - - /** + /* * @NoAdminRequired * * @param int $feedId + * @param bool $pinned * @param bool $fullTextEnabled + * @param int $updateMode + * @param int $ordering */ - public function enableFullText($feedId, $fullTextEnabled=false) { - try { - $this->feedService->enableFullText($feedId, $fullTextEnabled, - $this->userId); - } catch(ServiceNotFoundException $ex) { - return $this->error($ex, Http::STATUS_NOT_FOUND); - } - - return []; - } + public function patch($feedId, $pinned=null, $fullTextEnabled=null, $updateMode=null, $ordering=null) { + $attributes = [ + 'pinned' => $pinned, + 'fullTextEnabled' => $fullTextEnabled, + 'updateMode' => $updateMode, + 'ordering' => $ordering + ]; + $diff = array_filter($attributes, function ($value) { + return $value !== null; + }); - /** - * @NoAdminRequired - * - * @param int $feedId - * @param bool $isPinned - */ - public function pinned($feedId, $isPinned=false) { try { - $this->feedService->setPinned($feedId, $isPinned, $this->userId); + $this->feedService->patch($feedId, $this->userId, $diff); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } |