diff options
| author | 2022-04-26 08:47:19 +0200 | |
|---|---|---|
| committer | 2022-04-26 08:47:19 +0200 | |
| commit | 046598e743ac77dc4457edd60e421fd0d1963949 (patch) | |
| tree | 44a6420bcf726f7cbc97c67ea4634e827badbbe8 /app/Controllers/feedController.php | |
| parent | 55e6b7ea4cfd0b20e3bea8360f7e780ded7183b7 (diff) | |
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 <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers/feedController.php')
| -rwxr-xr-x | app/Controllers/feedController.php | 14 |
1 files changed, 9 insertions, 5 deletions
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++; } } |
