diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-09 12:57:35 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-09 12:57:35 +0200 |
commit | b8b4dfb4969e1baf84a14fb65a5dc153b0f5fae4 (patch) | |
tree | 27e211e26f442efd72a7f34903953ad57b1a9b76 /controller/foldercontroller.php | |
parent | fe0de2ab84a88cb4c742f4f10fd43716934b7282 (diff) |
only make one request for mark all read and mark folder read, fix #171, fix a bug that prevented readding of feeds when its folder was deleted, fix a bug that would not allow mark read for feeds when the app was started for the first time
Diffstat (limited to 'controller/foldercontroller.php')
-rw-r--r-- | controller/foldercontroller.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php index a2e0d028b..7542a5260 100644 --- a/controller/foldercontroller.php +++ b/controller/foldercontroller.php @@ -30,17 +30,25 @@ use \OCA\AppFramework\Core\API; use \OCA\AppFramework\Http\Request; use \OCA\News\BusinessLayer\FolderBusinessLayer; +use \OCA\News\BusinessLayer\FeedBusinessLayer; +use \OCA\News\BusinessLayer\ItemBusinessLayer; use \OCA\News\BusinessLayer\BusinessLayerException; class FolderController extends Controller { private $folderBusinessLayer; + private $feedBusinessLayer; + private $itemBusinessLayer; public function __construct(API $api, Request $request, - FolderBusinessLayer $folderBusinessLayer){ + FolderBusinessLayer $folderBusinessLayer, + FeedBusinessLayer $feedBusinessLayer, + ItemBusinessLayer $itemBusinessLayer){ parent::__construct($api, $request); $this->folderBusinessLayer = $folderBusinessLayer; + $this->feedBusinessLayer = $feedBusinessLayer; + $this->itemBusinessLayer = $itemBusinessLayer; } @@ -161,5 +169,23 @@ class FolderController extends Controller { } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function read(){ + $userId = $this->api->getUserId(); + $folderId = (int) $this->params('folderId'); + $highestItemId = (int) $this->params('highestItemId'); + + $this->itemBusinessLayer->readFolder($folderId, $highestItemId, $userId); + + $params = array( + 'feeds' => $this->feedBusinessLayer->findAll($userId) + ); + return $this->renderJSON($params); + } + }
\ No newline at end of file |