summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-08-16 12:56:17 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-08-16 12:56:17 +0200
commit2ba25ab970f9430116b55578aa9cef6ce157db88 (patch)
tree868a95ece8bd7da1029beb2e30b99fc8a11431e7 /js
parent6dcf152409c21f883e3082068bab75dc10a7fa39 (diff)
set only non displayed items as read
Diffstat (limited to 'js')
-rw-r--r--js/news.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/js/news.js b/js/news.js
index e17565b85..1c89fcc61 100644
--- a/js/news.js
+++ b/js/news.js
@@ -232,7 +232,17 @@ News={
return false;
},
setAllItemsRead:function(feedId) {
- $.post(OC.filePath('news', 'ajax', 'setallitemsread.php'), { 'feedId' : feedId }, function(jsonData) {
+ $items = $('.feed_item');
+ // dont execute if there are not read
+ if($items.length <= 0){
+ return;
+ }
+ // get the first items id to set lower ids as read
+ data = {
+ 'feedId' : feedId,
+ 'mostRecentItemId': $('.feed_item:first').data('id'),
+ };
+ $.post(OC.filePath('news', 'ajax', 'setallitemsread.php'), data, function(jsonData) {
if(jsonData.status == 'success'){
// mark ui items as read
$("#feed_items .feed_item:not(.read)").each(function(){