Category autoread by guid (#8673)

* Add configuration to mark same GUID as read in category.

Implement suggestion mentioned in #8641

Changes proposed in this pull request:

- Add a configuration to the categories to automatically mark entries as read if the same GUID is present in recent entries.  

How to test the feature manually:

1. Create a category. Check the option "Mark an article as read… if an identical GUID already exists [...]"  
2. Enable debug logs, or add an extension which registers to the hook `Minz_HookType::EntryAutoRead`.  
3. Add feeds which might have the same GUID.  
  For example: https://www.reddit.com/r/technology/hot.rss, https://www.reddit.com/r/technology/rising.rss, https://www.reddit.com/r/technology/best.rss, and https://www.reddit.com/r/technology/new.rss
4. See the logs "Mark GUID as read[...]", or the effect of the extension.  

* Implement behavior to mark same GUID as read in category.

* Update documentation

* Update i18n

* Fix PHP CS report

* Fix missing argument

* Fixes

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
pe1uca
2026-04-05 13:41:37 -04:00
committed by GitHub
parent d5f3126d6c
commit c44cd2b08f
34 changed files with 88 additions and 5 deletions

View File

@@ -887,8 +887,11 @@ class FreshRSS_Entry extends Minz_Model {
return (bool)$ok;
}
/** @param array<string,bool|int> $titlesAsRead */
public function applyFilterActions(array $titlesAsRead = []): void {
/**
* @param array<string,bool|int> $titlesAsRead
* @param array<string,bool|int> $guidsAsRead
*/
public function applyFilterActions(array $titlesAsRead = [], array $guidsAsRead = []): void {
$feed = $this->feed;
if ($feed === null) {
return;
@@ -903,6 +906,11 @@ class FreshRSS_Entry extends Minz_Model {
$this->_isRead(true);
Minz_ExtensionManager::callHook(Minz_HookType::EntryAutoRead, $this, 'same_title_in_feed');
}
if (!empty($guidsAsRead[$this->guid()])) {
Minz_Log::debug('Mark GUID as read: ' . $this->guid());
$this->_isRead(true);
Minz_ExtensionManager::callHook(Minz_HookType::EntryAutoRead, $this, 'same_guid_in_category');
}
}
FreshRSS_Context::userConf()->applyFilterActions($this);
$feed->category()?->applyFilterActions($this);