summaryrefslogtreecommitdiffstats
path: root/js/app/services/models
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-11 20:56:23 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-11 20:56:23 +0200
commitb06fc20ddbadbc7522cd23a83a20975f43889890 (patch)
tree252ddf454899920771466aa7d5b6376461c386e9 /js/app/services/models
parentce6b20c59e1140867f2353361d3524e3baeb4580 (diff)
allow users to discard folder and feed errors
Diffstat (limited to 'js/app/services/models')
-rw-r--r--js/app/services/models/feedmodel.coffee20
-rw-r--r--js/app/services/models/foldermodel.coffee22
2 files changed, 42 insertions, 0 deletions
diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee
index 5c4473b3a..405ea2651 100644
--- a/js/app/services/models/feedmodel.coffee
+++ b/js/app/services/models/feedmodel.coffee
@@ -144,5 +144,25 @@ angular.module('News').factory '_FeedModel',
return @get(query)
+ removeByUrlHash: (urlHash, clearCache=true) ->
+ ###
+ Remove an entry by id
+ ###
+
+ # remove from data map
+ for key, value of @_dataMap
+ if @_dataMap[key].urlHash == urlHash
+ delete @_dataMap[key]
+ break
+
+ for entry, counter in @_data
+ if entry.urlHash == urlHash
+ @_data.splice(counter, 1)
+ delete @_urlHash[urlHash]
+
+ if clearCache
+ @_invalidateCache()
+ break
+
return FeedModel
] \ No newline at end of file
diff --git a/js/app/services/models/foldermodel.coffee b/js/app/services/models/foldermodel.coffee
index eb1059fc8..5dad0bdae 100644
--- a/js/app/services/models/foldermodel.coffee
+++ b/js/app/services/models/foldermodel.coffee
@@ -116,5 +116,27 @@ angular.module('News').factory '_FolderModel',
return folderName.trim().toLowerCase()
+ removeByName: (name, clearCache=true) ->
+ ###
+ Remove an entry by id
+ ###
+ name = name.toLowerCase()
+
+ # remove from data map
+ for key, value of @_dataMap
+ if @_dataMap[key].name == name
+ delete @_dataMap[key]
+ break
+
+ for entry, counter in @_data
+ if entry.name == name
+ @_data.splice(counter, 1)
+ delete @_nameCache[name]
+
+ if clearCache
+ @_invalidateCache()
+ break
+
+
return FolderModel
] \ No newline at end of file