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/feedcontroller.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/feedcontroller.php')
-rw-r--r-- | controller/feedcontroller.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 63a2c3122..b453338d0 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -43,8 +43,8 @@ class FeedController extends Controller { private $itemBusinessLayer; public function __construct(API $api, Request $request, - FeedBusinessLayer $feedBusinessLayer, FolderBusinessLayer $folderBusinessLayer, + FeedBusinessLayer $feedBusinessLayer, ItemBusinessLayer $itemBusinessLayer){ parent::__construct($api, $request); $this->feedBusinessLayer = $feedBusinessLayer; @@ -138,6 +138,11 @@ class FeedController extends Controller { 'feeds' => array($feed) ); + try { + $params['newestItemId'] = + $this->itemBusinessLayer->getNewestItemId($userId); + } catch (BusinessLayerException $ex) {} + return $this->renderJSON($params); } catch(BusinessLayerException $ex) { return $this->renderJSON(array(), $ex->getMessage()); @@ -230,5 +235,28 @@ class FeedController extends Controller { return $this->renderJSON($params); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function read(){ + $userId = $this->api->getUserId(); + $feedId = (int) $this->params('feedId'); + $highestItemId = (int) $this->params('highestItemId'); + + $this->itemBusinessLayer->readFeed($feedId, $highestItemId, $userId); + + $params = array( + 'feeds' => array( + array( + 'id' => $feedId, + 'unreadCount' => 0 + ) + ) + ); + return $this->renderJSON($params); + } + }
\ No newline at end of file |