فهرست منبع

Fix bug articles not marked as read

https://github.com/FreshRSS/FreshRSS/issues/1123
https://github.com/FreshRSS/FreshRSS/issues/423
Alexandre Alapetite 9 سال پیش
والد
کامیت
b382f266de
1فایلهای تغییر یافته به همراه11 افزوده شده و 15 حذف شده
  1. 11 15
      p/scripts/main.js

+ 11 - 15
p/scripts/main.js

@@ -113,7 +113,7 @@ function incUnreadsFeed(article, feed_id, nb) {
 	return isCurrentView;
 	return isCurrentView;
 }
 }
 
 
-var pending_feeds = [];
+var pending_entries = {};
 function mark_read(active, only_not_read) {
 function mark_read(active, only_not_read) {
 	if (active.length === 0 ||
 	if (active.length === 0 ||
 		(only_not_read === true && !active.hasClass("not_read"))) {
 		(only_not_read === true && !active.hasClass("not_read"))) {
@@ -126,14 +126,12 @@ function mark_read(active, only_not_read) {
 	}
 	}
 
 
 	var feed_url = active.find(".website>a").attr("href"),
 	var feed_url = active.find(".website>a").attr("href"),
-		feed_id = feed_url.substr(feed_url.lastIndexOf('f_')),
-		index_pending = pending_feeds.indexOf(feed_id);
+		feed_id = feed_url.substr(feed_url.lastIndexOf('f_'));
 
 
-	if (index_pending !== -1) {
+	if (pending_entries[active.attr('id')]) {
 		return false;
 		return false;
 	}
 	}
-
-	pending_feeds.push(feed_id);
+	pending_entries[active.attr('id')] = true;
 
 
 	$.ajax({
 	$.ajax({
 		type: 'POST',
 		type: 'POST',
@@ -154,10 +152,10 @@ function mark_read(active, only_not_read) {
 		incUnreadsFeed(active, feed_id, inc);
 		incUnreadsFeed(active, feed_id, inc);
 		faviconNbUnread();
 		faviconNbUnread();
 
 
-		pending_feeds.splice(index_pending, 1);
+		delete pending_entries[active.attr('id')];
 	}).fail(function (data) {
 	}).fail(function (data) {
 		openNotification(i18n.notif_request_failed, 'bad');
 		openNotification(i18n.notif_request_failed, 'bad');
-		pending_feeds.splice(index_pending, 1);
+		delete pending_entries[active.attr('id')];
 	});
 	});
 }
 }
 
 
@@ -172,14 +170,12 @@ function mark_favorite(active) {
 	}
 	}
 
 
 	var feed_url = active.find(".website>a").attr("href"),
 	var feed_url = active.find(".website>a").attr("href"),
-		feed_id = feed_url.substr(feed_url.lastIndexOf('f_')),
-		index_pending = pending_feeds.indexOf(feed_id);
+		feed_id = feed_url.substr(feed_url.lastIndexOf('f_'));
 
 
-	if (index_pending !== -1) {
+	if (pending_entries[active.attr('id')]) {
 		return false;
 		return false;
 	}
 	}
-
-	pending_feeds.push(feed_id);
+	pending_entries[active.attr('id')] = true;
 
 
 	$.ajax({
 	$.ajax({
 		type: 'POST',
 		type: 'POST',
@@ -212,10 +208,10 @@ function mark_favorite(active) {
 			}
 			}
 		}
 		}
 
 
-		pending_feeds.splice(index_pending, 1);
+		delete pending_entries[active.attr('id')];
 	}).fail(function (data) {
 	}).fail(function (data) {
 		openNotification(i18n.notif_request_failed, 'bad');
 		openNotification(i18n.notif_request_failed, 'bad');
-		pending_feeds.splice(index_pending, 1);
+		delete pending_entries[active.attr('id')];
 	});
 	});
 }
 }