diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:49:18 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:49:18 +0100 |
commit | 03e4ec51b3444be4f0bdc324370c3416aa7d64c0 (patch) | |
tree | f1302e55560de06c0d4990745ff5dfef96365d1e /js/public | |
parent | 02ae36eba33a5e0957defd4619d337bfdd0c178f (diff) |
also update feedmodel if urlhash is the same
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/js/public/app.js b/js/public/app.js index d2ff687ae..e5b6e3cab 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -681,14 +681,38 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. function FeedModel(_utils) { this._utils = _utils; + this._urlHash = {}; FeedModel.__super__.constructor.call(this); } + FeedModel.prototype.clear = function() { + this._urlHash = {}; + return FeedModel.__super__.clear.call(this); + }; + FeedModel.prototype.add = function(item) { + var entry, key, value, _results; if (item.faviconLink === null) { item.faviconLink = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')'; } - return FeedModel.__super__.add.call(this, item); + entry = this._urlHash[item.urlHash]; + if (angular.isDefined(entry)) { + delete this._dataMap[entry.id]; + this._dataMap[item.id] = entry; + _results = []; + for (key in item) { + value = item[key]; + if (key === 'urlHash') { + continue; + } else { + _results.push(entry[key] = value); + } + } + return _results; + } else { + this._urlHash[item.urlHash] = item; + return FeedModel.__super__.add.call(this, item); + } }; FeedModel.prototype.getUnreadCount = function() { |