diff options
| author | 2016-08-02 00:29:31 +0200 | |
|---|---|---|
| committer | 2016-08-02 00:29:31 +0200 | |
| commit | b382f266de0369352344324f88bc5d3dc136119d (patch) | |
| tree | b262ed49e5bcd18fe9a63870456e41dacde9b163 /p/scripts | |
| parent | fde42d7af4cd6a1be433924eaddfa001fcd67cc6 (diff) | |
Fix bug articles not marked as read
https://github.com/FreshRSS/FreshRSS/issues/1123
https://github.com/FreshRSS/FreshRSS/issues/423
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index f1b82900e..c6e108ca1 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -113,7 +113,7 @@ function incUnreadsFeed(article, feed_id, nb) { return isCurrentView; } -var pending_feeds = []; +var pending_entries = {}; function mark_read(active, only_not_read) { if (active.length === 0 || (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"), - 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; } - - pending_feeds.push(feed_id); + pending_entries[active.attr('id')] = true; $.ajax({ type: 'POST', @@ -154,10 +152,10 @@ function mark_read(active, only_not_read) { incUnreadsFeed(active, feed_id, inc); faviconNbUnread(); - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }).fail(function (data) { 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"), - 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; } - - pending_feeds.push(feed_id); + pending_entries[active.attr('id')] = true; $.ajax({ 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) { openNotification(i18n.notif_request_failed, 'bad'); - pending_feeds.splice(index_pending, 1); + delete pending_entries[active.attr('id')]; }); } |
