summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-01 01:45:00 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-01 01:45:00 +0200
commit42f4244d44b35d172715dc7e70b6f3bd55d08005 (patch)
tree358f4f366aeb2a6c3df43ceff9809b37806c1dc4
parent4c39312cb3ffba28b103e49ac37f293fc5eea78b (diff)
mark all read works now
-rw-r--r--ajax/setallitemsread.php7
-rw-r--r--js/items.js2
-rw-r--r--js/menu.js9
3 files changed, 12 insertions, 6 deletions
diff --git a/ajax/setallitemsread.php b/ajax/setallitemsread.php
index d352b2aa3..aee0ff008 100644
--- a/ajax/setallitemsread.php
+++ b/ajax/setallitemsread.php
@@ -19,7 +19,7 @@ $feedId = $_POST['feedId'];
$mostRecentItemId = (int)$_POST['mostRecentItemId'];
$itemMapper = new OCA\News\ItemMapper();
-$mostRecentItem = $itemMapper->find($mostRecentItemId);
+
//echo $mostRecentItem->getDate();
switch ($feedId) {
case -2:
@@ -40,9 +40,12 @@ switch ($feedId) {
// FeedMapper instead of iterating through every item and updating as
// necessary
$success = false;
+if($mostRecentItemId !== 0){
+ $mostRecentItem = $itemMapper->find($mostRecentItemId);
+}
foreach($items as $item){
// FIXME: this should compare the modified date
- if($item->getDate() <= $mostRecentItem->getDate()){
+ if($mostRecentItemId === 0 || $item->getDate() <= $mostRecentItem->getDate()){
$item->setRead();
$success = $itemMapper->update($item);
}
diff --git a/js/items.js b/js/items.js
index 64a5f4d53..85b90f764 100644
--- a/js/items.js
+++ b/js/items.js
@@ -196,7 +196,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
* Marks all items of a feed as read
* @param feedId the id of the feed which should be marked as read
*/
- Items.prototype.markAllRead = function(feedId) {
+ ItemCache.prototype.markAllRead = function(feedId) {
if(this._feeds[feedId] !== undefined){
$.each(this._feeds[feedId], function(key, value){
value.addReadClass();
diff --git a/js/menu.js b/js/menu.js
index cd41fa63c..cb9f7886a 100644
--- a/js/menu.js
+++ b/js/menu.js
@@ -513,7 +513,7 @@ var News = News || {};
return false;
});
- $listItem.children('.feeds_markread').click(function(){
+ $listItem.children('.buttons').children('.feeds_markread').click(function(){
self._markRead(MenuNodeType.Subscriptions, 0);
});
};
@@ -593,9 +593,12 @@ var News = News || {};
break;
case MenuNodeType.Subscriptions:
- this._root.children('li').each(function(){
+ this._$root.children('li').each(function(){
var childData = self._getIdAndTypeFromNode($(this));
- self._markRead(childData.type, childData.id);
+ if(childData.type === MenuNodeType.Folder ||
+ childData.type === MenuNodeType.Feed){
+ self._markRead(childData.type, childData.id);
+ }
});
break;