summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-25 23:23:56 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-25 23:24:47 +0100
commit866f5eef01f95c692061acac7a6946db3949e61b (patch)
tree2ad83bab23b4d0201ea7373683c11eeb08ffb90d
parent18680c8c448bc296b649c7eaa745468c301bff0f (diff)
fix bad setter usage
-rw-r--r--bl/feedbl.php3
-rw-r--r--controller/usersettingscontroller.php9
-rw-r--r--js/app/services/models/itemmodel.coffee2
-rw-r--r--js/tests/controllers/feedcontrollerSpec.coffee2
-rw-r--r--templates/part.showall.php6
-rw-r--r--tests/controller/UserSettingsControllerTest.php11
6 files changed, 15 insertions, 18 deletions
diff --git a/bl/feedbl.php b/bl/feedbl.php
index 105a43a05..3f7fe0ceb 100644
--- a/bl/feedbl.php
+++ b/bl/feedbl.php
@@ -68,6 +68,7 @@ class FeedBl extends Bl {
// insert feed
$feed->setFolderId($folderId);
+ $feed->setUserId($userId);
$feed = $this->mapper->insert($feed);
// insert items
@@ -88,7 +89,7 @@ class FeedBl extends Bl {
$feeds = $this->mapper->findAll();
foreach($feeds as $feed){
try {
- $this->update($feed->getId(), $feed->getUser());
+ $this->update($feed->getId(), $feed->getUserId());
} catch(BLException $ex){
continue;
}
diff --git a/controller/usersettingscontroller.php b/controller/usersettingscontroller.php
index 157dee7ff..db87276f8 100644
--- a/controller/usersettingscontroller.php
+++ b/controller/usersettingscontroller.php
@@ -45,10 +45,9 @@ class UserSettingsController extends Controller {
*/
public function read(){
$userId = $this->api->getUserId();
- $showAll = $this->api->getUserValue($userId, 'showAll');
-
+ $showAll = $this->api->getUserValue('showAll');
$params = array(
- 'showAll' => $showAll === 'true'
+ 'showAll' => $showAll === '1'
);
return $this->renderJSON($params);
@@ -62,7 +61,7 @@ class UserSettingsController extends Controller {
*/
public function show(){
$userId = $this->api->getUserId();
- $this->api->setUserValue($userId, 'showAll', true);
+ $this->api->setUserValue('showAll', true);
return $this->renderJSON();
}
@@ -75,7 +74,7 @@ class UserSettingsController extends Controller {
*/
public function hide(){
$userId = $this->api->getUserId();
- $this->api->setUserValue($userId, 'showAll', false);
+ $this->api->setUserValue('showAll', false);
return $this->renderJSON();
}
diff --git a/js/app/services/models/itemmodel.coffee b/js/app/services/models/itemmodel.coffee
index 890f18964..18af373d9 100644
--- a/js/app/services/models/itemmodel.coffee
+++ b/js/app/services/models/itemmodel.coffee
@@ -44,7 +44,7 @@ angular.module('News').factory '_ItemModel',
if angular.isDefined(highestId)
return highestId.id
else
- return 0
+ return 0
return ItemModel
diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee
index 2b5d1f54c..df3917ea8 100644
--- a/js/tests/controllers/feedcontrollerSpec.coffee
+++ b/js/tests/controllers/feedcontrollerSpec.coffee
@@ -222,7 +222,7 @@ describe '_FeedController', ->
it 'should delete folders', =>
@FolderModel.removeById = jasmine.createSpy('remove')
@persistence.deleteFolder = jasmine.createSpy('deletequery')
- @scope.delete(@FeedType.Folder, 3)
+ @scope.delete(@FeedType.Folder, 3)
expect(@FolderModel.removeById).toHaveBeenCalledWith(3)
expect(@persistence.deleteFolder).toHaveBeenCalledWith(3)
diff --git a/templates/part.showall.php b/templates/part.showall.php
index 3bbd719b8..61f9cc11d 100644
--- a/templates/part.showall.php
+++ b/templates/part.showall.php
@@ -1,7 +1,7 @@
<li ui-if="!isShowAll()" class="show-all">
- <a ng-click="setShowAll(true)" href="#"><?php p($l->t('Show all')); ?></a>
+ <a ng-click="setShowAll(true)" href="#"><?php p($l->t('Show all')); ?></a>
</li>
-<li ui-if="istShowAll()" class="show-all">
- <a ng-click="setShowAll(false)" href="#"><?php p($l->t('Show only unread')); ?></a>
+<li ui-if="isShowAll()" class="show-all">
+ <a ng-click="setShowAll(false)" href="#"><?php p($l->t('Show only unread')); ?></a>
</li>
diff --git a/tests/controller/UserSettingsControllerTest.php b/tests/controller/UserSettingsControllerTest.php
index 4b561a3e4..6754d0c7a 100644
--- a/tests/controller/UserSettingsControllerTest.php
+++ b/tests/controller/UserSettingsControllerTest.php
@@ -80,8 +80,7 @@ class UserSettingsControllerTest extends ControllerTestUtility {
->will($this->returnValue($this->user));
$this->api->expects($this->once())
->method('setUserValue')
- ->with($this->equalTo($this->user),
- $this->equalTo('showAll'),
+ ->with($this->equalTo('showAll'),
$this->equalTo(true));
$result = $this->controller->show();
}
@@ -93,8 +92,7 @@ class UserSettingsControllerTest extends ControllerTestUtility {
->will($this->returnValue($this->user));
$this->api->expects($this->once())
->method('setUserValue')
- ->with($this->equalTo($this->user),
- $this->equalTo('showAll'),
+ ->with($this->equalTo('showAll'),
$this->equalTo(false));
$result = $this->controller->hide();
}
@@ -109,9 +107,8 @@ class UserSettingsControllerTest extends ControllerTestUtility {
->will($this->returnValue($this->user));
$this->api->expects($this->once())
->method('getUserValue')
- ->with($this->equalTo($this->user),
- $this->equalTo('showAll'))
- ->will($this->returnValue('true'));
+ ->with($this->equalTo('showAll'))
+ ->will($this->returnValue('1'));
$response = $this->controller->read();
$this->assertEquals($result, $response->getParams());