From 842b39c380a1996205042a62d00f0a22db94364a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 23 Mar 2013 16:43:50 +0100 Subject: various bugfixes --- db/itemmapper.php | 6 +++--- js/app/services/persistence.coffee | 4 ++-- js/app/services/services.coffee | 2 +- js/public/app.js | 15 ++++++++++----- templates/main.php | 12 ++++++------ tests/db/ItemMapperTest.php | 7 ++++--- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/db/itemmapper.php b/db/itemmapper.php index e4ebee433..0d9469c9d 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -52,10 +52,10 @@ class ItemMapper extends Mapper implements IMapper { private function makeSelectQuery($prependTo){ - return 'SELECT `*PREFIX*news_items`.* FROM `*PREFIX*news_items` ' . - 'JOIN `*PREFIX*news_feeds` ' . + return 'SELECT `*PREFIX*news_items`.* FROM `*PREFIX*news_items` `items` '. + 'JOIN `*PREFIX*news_feeds` `feeds` ' . 'ON `*PREFIX*news_feeds`.`id` = `*PREFIX*news_items`.`feed_id` '. - 'AND `*PREFIX*news_feeds`.`user_id` = ? ' . $prependTo; + 'AND `*PREFIX*news_feeds`.`user_id` = ? ' . $prependTo; } private function makeSelectQueryStatus($prependTo) { diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 80d8d391d..6f75d4601 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -37,7 +37,7 @@ angular.module('News').factory '_Persistence', -> # items can only be loaded after the active feed is known @getActiveFeed => - @getItems @_activeFeed.getType(), @_activeFeed.getId(), null, => + @getItems @_activeFeed.getType(), @_activeFeed.getId(), 0, => @_loading.decrease() @getAllFolders(@_triggerHideRead) @@ -50,7 +50,7 @@ angular.module('News').factory '_Persistence', -> ITEM CONTROLLER ### getItems: (type, id, offset, onSuccess, updatedSince=null) -> - # TODO + if updatedSince != null data = updatedSince: updatedSince diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee index 08d4d6274..dac4206a9 100644 --- a/js/app/services/services.coffee +++ b/js/app/services/services.coffee @@ -23,7 +23,7 @@ License along with this library. If not, see . # request related stuff angular.module('News').factory 'Persistence', ['_Persistence', 'Request', -'FeedLoading', 'Config', '$rootScope', 'ActiveFeed', +'FeedLoading', 'Config', 'ActiveFeed', '$rootScope', (_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) -> return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope) ] diff --git a/js/public/app.js b/js/public/app.js index d7b0d2f2a..f57367fa0 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -103,8 +103,8 @@ License along with this library. If not, see . ]); angular.module('News').controller('ItemController', [ - '$scope', '_ItemController', 'ItemModel', function($scope, _ItemController, ItemModel) { - return new _ItemController($scope, ItemModel); + '$scope', '_ItemController', 'ItemModel', 'FeedLoading', function($scope, _ItemController, ItemModel, FeedLoading) { + return new _ItemController($scope, ItemModel, FeedLoading); } ]); @@ -184,9 +184,14 @@ License along with this library. If not, see . var ItemController; ItemController = (function() { - function ItemController($scope, itemModel) { + function ItemController($scope, itemModel, feedLoading) { + var _this = this; this.$scope = $scope; this.itemModel = itemModel; + this.feedLoading = feedLoading; + this.$scope.isLoading = function() { + return _this.feedLoading.isLoading(); + }; } return ItemController; @@ -651,7 +656,7 @@ License along with this library. If not, see . var _this = this; this._loading.increase(); this.getActiveFeed(function() { - return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), null, function() { + return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), 0, function() { return _this._loading.decrease(); }); }); @@ -1032,7 +1037,7 @@ License along with this library. If not, see . (function() { angular.module('News').factory('Persistence', [ - '_Persistence', 'Request', 'FeedLoading', 'Config', '$rootScope', 'ActiveFeed', function(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) { + '_Persistence', 'Request', 'FeedLoading', 'Config', 'ActiveFeed', '$rootScope', function(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) { return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope); } ]); diff --git a/templates/main.php b/templates/main.php index 9690e3cbe..2de7c0fba 100644 --- a/templates/main.php +++ b/templates/main.php @@ -24,11 +24,11 @@
    inc('part.addnew')) ?> - inc('part.feed.unread')) ?> - inc('part.feed.starred')) ?> - inc('part.listfolder')) ?> - inc('part.listfeed', array('folderId' => '0'))) ?> - inc('part.showall')); ?> + inc('part.feed.unread')) ?> + inc('part.feed.starred')) ?> + inc('part.listfolder')) ?> + inc('part.listfeed', array('folderId' => '0'))) ?> + inc('part.showall')); ?>
@@ -49,7 +49,7 @@
- inc("part.items")); ?> + inc("part.items")); ?>
\ No newline at end of file diff --git a/tests/db/ItemMapperTest.php b/tests/db/ItemMapperTest.php index b792daac3..626ac2cd0 100644 --- a/tests/db/ItemMapperTest.php +++ b/tests/db/ItemMapperTest.php @@ -72,12 +72,13 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { private function makeSelectQuery($prependTo){ - return 'SELECT `*PREFIX*news_items`.* FROM `*PREFIX*news_items` ' . - 'JOIN `*PREFIX*news_feeds` ' . + return 'SELECT `*PREFIX*news_items`.* FROM `*PREFIX*news_items` `items` '. + 'JOIN `*PREFIX*news_feeds` `feeds` ' . 'ON `*PREFIX*news_feeds`.`id` = `*PREFIX*news_items`.`feed_id` '. - 'AND `*PREFIX*news_feeds`.`user_id` = ? ' . $prependTo; + 'AND `*PREFIX*news_feeds`.`user_id` = ? ' . $prependTo; } + private function makeSelectQueryStatus($prependTo) { return $this->makeSelectQuery( 'AND ((`*PREFIX*news_items`.`status` & ?) > 0) ' . -- cgit v1.2.3