diff options
-rw-r--r-- | js/app/services/models/feedmodel.coffee | 3 | ||||
-rw-r--r-- | js/app/services/persistence.coffee | 4 | ||||
-rw-r--r-- | js/public/app.js | 9 |
3 files changed, 12 insertions, 4 deletions
diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee index 838f240c1..def720edf 100644 --- a/js/app/services/models/feedmodel.coffee +++ b/js/app/services/models/feedmodel.coffee @@ -47,8 +47,9 @@ angular.module('News').factory '_FeedModel', getFeedUnreadCount: (feedId) -> feed = @getById(feedId) + count = 0 if angular.isDefined(feed) - return feed.unreadCount + return count += feed.unreadCount else return 0 diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index fab268518..200145c71 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -52,7 +52,9 @@ angular.module('News').factory '_Persistence', -> ### ITEM CONTROLLER ### - getItems: (type, id, offset, onSuccess, updatedSince=null) -> + getItems: (type, id, offset, onSuccess=null, updatedSince=null) -> + + onSuccess or= -> if updatedSince != null data = diff --git a/js/public/app.js b/js/public/app.js index d8303f06f..375b02554 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -553,10 +553,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; FeedModel.prototype.getFeedUnreadCount = function(feedId) { - var feed; + var count, feed; feed = this.getById(feedId); + count = 0; if (angular.isDefined(feed)) { - return feed.unreadCount; + return count += feed.unreadCount; } else { return 0; } @@ -890,9 +891,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) { var data, params; + if (onSuccess == null) { + onSuccess = null; + } if (updatedSince == null) { updatedSince = null; } + onSuccess || (onSuccess = function() {}); if (updatedSince !== null) { data = { updatedSince: updatedSince, |