From 046598e743ac77dc4457edd60e421fd0d1963949 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Tue, 26 Apr 2022 08:47:19 +0200 Subject: fix depending results after changing value of "entry->isRead" (#4331) * fix depending results after changing value of "entry->isRead" inside of hook 'entry_before_insert' if anybody use the hook 'entry_before_insert' and change the value of the property 'entry->isRead', the depending results are correct now. In my case my config let all new entrys as "isRead=FALSE" as i will. A new extension which is in progress, can/should/must change the value of this property, but the depending results of this property are wrong before this fix. * Update app/Controllers/feedController.php Co-authored-by: Alexandre Alapetite --- app/Controllers/feedController.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index cd4039470..758f39c88 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -432,11 +432,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } else { //This entry already exists but has been updated //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) . //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); - $needFeedCacheRefresh = $mark_updated_article_unread; $entry->_isRead($mark_updated_article_unread ? false : null); //Change is_read according to policy. - if ($mark_updated_article_unread) { - $feed->incPendingUnread(); //Maybe - } $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); if ($entry === null) { @@ -444,6 +440,11 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { continue; } + if (!$entry->isRead()) { + $needFeedCacheRefresh = true; + $feed->incPendingUnread(); //Maybe + } + // If the entry has changed, there is a good chance for the full content to have changed as well. $entry->loadCompleteContent(true); @@ -480,7 +481,10 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { $entryDAO->beginTransaction(); } $entryDAO->addEntry($entry->toArray()); - $feed->incPendingUnread(); + + if (!$entry->isRead()) { + $feed->incPendingUnread(); + } $nb_new_articles++; } } -- cgit v1.2.3