From ecc4a533ccf0c56527b4aaaa94a22a0dddf29fa2 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 23 Mar 2013 16:18:43 +0100 Subject: use all articles if active feed is null --- controller/feedcontroller.php | 4 ++++ js/app/controllers/controllers.coffee | 6 +++--- js/app/controllers/itemcontroller.coffee | 5 ++++- templates/main.php | 2 +- tests/controller/FeedControllerTest.php | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 27ab07408..1a29731b4 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -81,8 +81,12 @@ class FeedController extends Controller { try { if($feedType === FeedType::FOLDER){ $this->folderBl->find($feedId, $userId); + } elseif ($feedType === FeedType::FEED){ $this->feedBl->find($feedId, $userId); + + } elseif($feedType === null || $feedId === null){ + throw new BLException(''); } } catch (BLException $ex){ $feedId = 0; diff --git a/js/app/controllers/controllers.coffee b/js/app/controllers/controllers.coffee index 55566f7d0..b3a246fda 100644 --- a/js/app/controllers/controllers.coffee +++ b/js/app/controllers/controllers.coffee @@ -36,8 +36,8 @@ angular.module('News').controller 'FeedController', ] angular.module('News').controller 'ItemController', -['$scope', '_ItemController', 'ItemModel', -($scope, _ItemController, ItemModel)-> +['$scope', '_ItemController', 'ItemModel', 'FeedLoading', +($scope, _ItemController, ItemModel, FeedLoading)-> - return new _ItemController($scope, ItemModel) + return new _ItemController($scope, ItemModel, FeedLoading) ] \ No newline at end of file diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee index 3350c674e..163d652ca 100644 --- a/js/app/controllers/itemcontroller.coffee +++ b/js/app/controllers/itemcontroller.coffee @@ -25,7 +25,10 @@ angular.module('News').factory '_ItemController', -> class ItemController - constructor: (@$scope, @itemModel) -> + constructor: (@$scope, @itemModel, @feedLoading) -> + + @$scope.isLoading = => + return @feedLoading.isLoading() return ItemController \ No newline at end of file diff --git a/templates/main.php b/templates/main.php index 422259c64..9690e3cbe 100644 --- a/templates/main.php +++ b/templates/main.php @@ -47,7 +47,7 @@ -
inc("part.items")); ?>
diff --git a/tests/controller/FeedControllerTest.php b/tests/controller/FeedControllerTest.php index 6adae204c..4ccb7bed6 100644 --- a/tests/controller/FeedControllerTest.php +++ b/tests/controller/FeedControllerTest.php @@ -215,6 +215,25 @@ class FeedControllerTest extends ControllerTestUtility { } + public function testActiveActiveIsNull(){ + $id = 3; + $type = null; + $result = array( + 'activeFeed' => array( + 'id' => 0, + 'type' => FeedType::SUBSCRIPTIONS + ) + ); + + $this->activeInitMocks($id, $type); + + $response = $this->controller->active(); + + $this->assertEquals($result, $response->getParams()); + $this->assertTrue($response instanceof JSONResponse); + } + + public function testCreate(){ $result = array( 'feeds' => array(new Feed()) -- cgit v1.2.3