summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-20 21:51:31 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-20 21:51:42 +0200
commit18b523b8082cdfb5ce903d1183c35d618d7f5f29 (patch)
treea67eba086f26dd396e1237abc2d15f6eb278dbba /controller
parent4d36b4415586aba4b7fcac11d4e99fd768d6d716 (diff)
Also load the newest feed data when you load a feed
Edit fix #102
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index 9081578ed..84f177cd6 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -30,16 +30,20 @@ use \OCA\AppFramework\Core\API;
use \OCA\AppFramework\Http\Request;
use \OCA\News\BusinessLayer\ItemBusinessLayer;
+use \OCA\News\BusinessLayer\FeedBusinessLayer;
class ItemController extends Controller {
private $itemBusinessLayer;
+ private $feedBusinessLayer;
public function __construct(API $api, Request $request,
- ItemBusinessLayer $itemBusinessLayer){
+ ItemBusinessLayer $itemBusinessLayer,
+ FeedBusinessLayer $feedBusinessLayer){
parent::__construct($api, $request);
$this->itemBusinessLayer = $itemBusinessLayer;
+ $this->feedBusinessLayer = $feedBusinessLayer;
}
@@ -63,6 +67,9 @@ class ItemController extends Controller {
$offset = (int) $this->params('offset', 0);
$items = $this->itemBusinessLayer->findAll($id, $type, (int) $limit,
$offset, $showAll, $userId);
+ if($offset === 0) {
+ $feeds = $this->feedBusinessLayer->findAll($userId);
+ }
} else {
$updatedSince = (int) $this->params('updatedSince');
$items = $this->itemBusinessLayer->findAllNew($id, $type,
@@ -73,6 +80,12 @@ class ItemController extends Controller {
'items' => $items
);
+ // we need to pass the newest feeds to not let the unread count get out
+ // of sync
+ if(isset($feeds)) {
+ $params['feeds'] = $feeds;
+ }
+
return $this->renderJSON($params);
}