aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Entry.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-07-05 11:00:26 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-05 11:00:26 +0200
commit1db606bc1b6cf25d9b9c4bef362acdb964ce1e8a (patch)
tree9556fec20e66270f7117850530de01f0f3c36b65 /app/Models/Entry.php
parentebf62a4296b8007527325374608de5a7b972d598 (diff)
New extension hook entry_auto_read (#5505)
* New extension hook entry_auto_read For extensions to be notified of articles being automatically marked as read for various reasons * Documentation + entry_auto_unread
Diffstat (limited to 'app/Models/Entry.php')
-rw-r--r--app/Models/Entry.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index 9e3e97d1a..86b3899d8 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -643,20 +643,27 @@ HTML;
/** @param array<string,bool> $titlesAsRead */
public function applyFilterActions(array $titlesAsRead = []): void {
if ($this->feed != null) {
- if ($this->feed->attributes('read_upon_reception') ||
- ($this->feed->attributes('read_upon_reception') === null && FreshRSS_Context::$user_conf->mark_when['reception'])) {
- $this->_isRead(true);
- }
- if (!empty($titlesAsRead[$this->title()])) {
- Minz_Log::debug('Mark title as read: ' . $this->title());
- $this->_isRead(true);
+ if (!$this->isRead()) {
+ if ($this->feed->attributes('read_upon_reception') ||
+ ($this->feed->attributes('read_upon_reception') === null && FreshRSS_Context::$user_conf->mark_when['reception'])) {
+ $this->_isRead(true);
+ Minz_ExtensionManager::callHook('entry_auto_read', $this, 'upon_reception');
+ }
+ if (!empty($titlesAsRead[$this->title()])) {
+ Minz_Log::debug('Mark title as read: ' . $this->title());
+ $this->_isRead(true);
+ Minz_ExtensionManager::callHook('entry_auto_read', $this, 'same_title_in_feed');
+ }
}
foreach ($this->feed->filterActions() as $filterAction) {
if ($this->matches($filterAction->booleanSearch())) {
foreach ($filterAction->actions() as $action) {
switch ($action) {
case 'read':
- $this->_isRead(true);
+ if (!$this->isRead()) {
+ $this->_isRead(true);
+ Minz_ExtensionManager::callHook('entry_auto_read', $this, 'filter');
+ }
break;
case 'star':
$this->_isFavorite(true);