From b250747c6681dca656b0761f70f53d0295d228d1 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sun, 1 Nov 2015 14:25:05 +0100 Subject: fix #882 --- controller/feedcontroller.php | 52 +++++++++++++------------------------------ 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'controller') 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); } -- cgit v1.2.3