From 8ddead06277f7c863fe048e9990d4c9ce0c24424 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 21 Nov 2014 13:53:36 +0100 Subject: fix #660 --- js/build/app.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'js/build/app.js') diff --git a/js/build/app.js b/js/build/app.js index 7a12eb56c..569672a27 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -459,17 +459,17 @@ app.controller('ExploreController', ["sites", "$rootScope", "FeedResource", func this.sites = sites; - this.feedExists = function (url) { - return FeedResource.get(url) !== undefined; + this.feedExists = function (location) { + return FeedResource.getByLocation(location) !== undefined; }; - this.subscribeTo = function (url) { - $rootScope.$broadcast('addFeed', url); + this.subscribeTo = function (location) { + $rootScope.$broadcast('addFeed', location); }; this.isCategoryShown = function (data) { return data.filter(function (element) { - return FeedResource.get(element.url) === undefined; + return FeedResource.getByLocation(element.feed) === undefined; }).length > 0; }; @@ -884,6 +884,7 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Re var FeedResource = function ($http, BASE_URL, $q) { Resource.call(this, $http, BASE_URL, 'url'); this.ids = {}; + this.locations = {}; this.unreadCount = 0; this.folderUnreadCount = {}; this.folderIds = {}; @@ -904,6 +905,7 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Re this.folderUnreadCount = {}; this.folderIds = {}; this.ids = {}; + this.locations = {}; }; FeedResource.prototype.updateUnreadCache = function () { @@ -941,6 +943,9 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Re if (value.id !== undefined) { this.ids[value.id] = this.hashMap[value.url]; } + if (value.location !== undefined) { + this.locations[value.location] = this.hashMap[value.url]; + } }; @@ -1012,6 +1017,10 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Re }; + FeedResource.prototype.getByLocation = function (location) { + return this.locations[location]; + }; + FeedResource.prototype.rename = function (id, title) { return this.http({ method: 'POST', @@ -1123,6 +1132,10 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", "$q", function (Re delete this.ids[feed.id]; } + if (feed !== undefined && feed.location) { + delete this.locations[feed.location]; + } + Resource.prototype.delete.call(this, url); if (updateCache !== false) { -- cgit v1.2.3