From b8b4dfb4969e1baf84a14fb65a5dc153b0f5fae4 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 9 May 2013 12:57:35 +0200 Subject: 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 --- external/folderapi.php | 16 +++++++++++++++- external/itemapi.php | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'external') diff --git a/external/folderapi.php b/external/folderapi.php index 642ca1968..879d62b5a 100644 --- a/external/folderapi.php +++ b/external/folderapi.php @@ -30,6 +30,7 @@ use \OCA\AppFramework\Controller\Controller; use \OCA\AppFramework\Http\Request; use \OCA\News\BusinessLayer\FolderBusinessLayer; +use \OCA\News\BusinessLayer\ItemBusinessLayer; use \OCA\News\BusinessLayer\BusinessLayerException; use \OCA\News\BusinessLayer\BusinessLayerExistsException; @@ -37,12 +38,15 @@ use \OCA\News\BusinessLayer\BusinessLayerExistsException; class FolderAPI extends Controller { private $folderBusinessLayer; + private $itemBusinessLayer; public function __construct(API $api, Request $request, - FolderBusinessLayer $folderBusinessLayer){ + FolderBusinessLayer $folderBusinessLayer, + ItemBusinessLayer $itemBusinessLayer){ parent::__construct($api, $request); $this->folderBusinessLayer = $folderBusinessLayer; + $this->itemBusinessLayer = $itemBusinessLayer; } @@ -113,4 +117,14 @@ class FolderAPI extends Controller { } + public function read() { + $userId = $this->api->getUserId(); + $folderId = (int) $this->params('folderId'); + $newestItemId = (int) $this->params('newestItemId'); + + $this->itemBusinessLayer->readFolder($folderId, $newestItemId, $userId); + return new NewsAPIResult(); + } + + } diff --git a/external/itemapi.php b/external/itemapi.php index 9699b4371..2ba1fcaed 100644 --- a/external/itemapi.php +++ b/external/itemapi.php @@ -147,4 +147,13 @@ class ItemAPI extends Controller { } + public function readAll() { + $userId = $this->api->getUserId(); + $newestItemId = (int) $this->params('newestItemId'); + + $this->itemBusinessLayer->readAll($newestItemId, $userId); + return new NewsAPIResult(); + } + + } -- cgit v1.2.3