diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-17 10:50:46 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-17 10:51:04 +0200 |
commit | 1fbcd35ac8f868e48228aafa375c5a305554a3c3 (patch) | |
tree | f3b40fa3e34f90774097bf78ceffc7f4527fa05b /js/app/services | |
parent | 19b9456b6a96e8139d62a498fb31a96ed36fb442 (diff) |
always return the unreadcount when marking read to set update request as 0, dont create new feeds that only consist of unreadcount updates
Diffstat (limited to 'js/app/services')
-rw-r--r-- | js/app/services/models/feedmodel.coffee | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee index fb0ba8e14..f0296957e 100644 --- a/js/app/services/models/feedmodel.coffee +++ b/js/app/services/models/feedmodel.coffee @@ -62,24 +62,27 @@ angular.module('News').factory 'FeedModel', if updateById or updateByUrlHash @update(data, clearCache) else - # if the item is not yet in the name cache it must be added - @_urlHash[data.urlHash] = data - - # in case there is an id it can go through the normal add method - if angular.isDefined(data.id) - super(data, clearCache) - - # if there is no id we just want it to appear in the list - else - @_data.push(data) - if clearCache - @_invalidateCache() + if angular.isDefined(data.urlHash) + # if the item is not yet in the name cache it must be added + @_urlHash[data.urlHash] = data + + # in case there is an id it can go through the normal add method + if angular.isDefined(data.id) + super(data, clearCache) + + # if there is no id we just want it to appear in the list + else + @_data.push(data) + if clearCache + @_invalidateCache() update: (data, clearCache=true) -> # only when the id on the updated item does not exist we wish # to update by name, otherwise we always update by id - item = @_urlHash[data.urlHash] + if angular.isDefined(data.urlHash) + item = @_urlHash[data.urlHash] + # update by name if angular.isUndefined(data.id) and angular.isDefined(item) angular.extend(item, data) |