diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:26:04 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:26:04 +0100 |
commit | 02ae36eba33a5e0957defd4619d337bfdd0c178f (patch) | |
tree | d80f58cdf9eb774d00fc5fc322bf0750b644dab2 /js/public | |
parent | 89a1713f062cc78b727c6240a91408d91611dbab (diff) |
fixed mark all unread serverside (was missing highestitemid, dont use lastmodified to compare for new versions but use the highest item id. if items are updated and the guidHash and feedId are the same then it will be deleted and newly inserted to make the lastmodified feasable
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/js/public/app.js b/js/public/app.js index 9efc9aece..d2ff687ae 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -372,7 +372,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. type: type }); } else { - lastModified = this._itemModel.getLastModified(); + lastModified = this._itemModel.getHighestId(); return this._persistence.getItems(type, id, 0, null, lastModified); } }; @@ -824,17 +824,38 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. __extends(ItemModel, _super); function ItemModel() { - return ItemModel.__super__.constructor.apply(this, arguments); + this._guidFeedIdHash = {}; + ItemModel.__super__.constructor.call(this); } - ItemModel.prototype.getLastModified = function() { - var lastModified, query; - query = new _MaximumQuery('lastModified'); - lastModified = this.get(query); - if (angular.isDefined(lastModified)) { - return lastModified.lastModified; + ItemModel.prototype.clear = function() { + this._guidFeedIdHash = {}; + return ItemModel.__super__.clear.call(this); + }; + + ItemModel.prototype.add = function(data, clearCache) { + var entry, hash, key, value, _results; + if (clearCache == null) { + clearCache = true; + } + hash = data.feedId + '_' + data.guidHash; + entry = this._guidFeedIdHash[hash]; + if (angular.isDefined(entry)) { + delete this._dataMap[entry.id]; + this._dataMap[data.id] = entry; + _results = []; + for (key in data) { + value = data[key]; + if (key === 'feedId' || key === 'guidHash') { + continue; + } else { + _results.push(entry[key] = value); + } + } + return _results; } else { - return null; + this._guidFeedIdHash[hash] = data; + return ItemModel.__super__.add.call(this, data, clearCache); } }; |