Skip to content

A free, self-hostable news aggregator…

Category autoread by guid (#8673)

pe1ucac44cd2b08f7f
diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php
index eca768050..f0b45f803 100644
--- a/app/Controllers/categoryController.php
+++ b/app/Controllers/categoryController.php
@@ -109,6 +109,11 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
} else {
$category->_attribute('read_when_same_title_in_category', null);
}
+ if (Minz_Request::paramBoolean('enable_read_when_same_guid_in_category')) {
+ $category->_attribute('read_when_same_guid_in_category', Minz_Request::paramInt('read_when_same_guid_in_category'));
+ } else {
+ $category->_attribute('read_when_same_guid_in_category', null);
+ }
$category->_filtersAction('read', Minz_Request::paramTextToArray('filteractions_read', plaintext: true));
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index efdaea7f3..4ee17231f 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -468,6 +468,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$feedsCacheToRefresh = [];
/** @var array<int,array<string,true>> */
$categoriesEntriesTitle = [];
+ /** @var array<int,array<string,true>> */
+ $categoriesEntriesGuid = [];
$feeds = Minz_ExtensionManager::callHook(Minz_HookType::FeedsListBeforeActualize, $feeds);
if (is_array($feeds)) {
@@ -601,6 +603,12 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
true
);
}
+ if (!isset($categoriesEntriesGuid[$feed->categoryId()]) && $category !== null && $category->hasAttribute('read_when_same_guid_in_category')) {
+ $categoriesEntriesGuid[$feed->categoryId()] = array_fill_keys(
+ $catDAO->listGuids($feed->categoryId(), $category->attributeInt('read_when_same_guid_in_category') ?? 0),
+ true
+ );
+ }
$mark_updated_article_unread = $feed->attributeBoolean('mark_updated_article_unread') ?? FreshRSS_Context::userConf()->mark_updated_article_unread;
@@ -646,6 +654,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
if (isset($categoriesEntriesTitle[$feed->categoryId()])) {
$categoriesEntriesTitle[$feed->categoryId()][$entry->title()] = true;
}
+ if (isset($categoriesEntriesGuid[$feed->categoryId()])) {
+ $categoriesEntriesGuid[$feed->categoryId()][$entry->guid()] = true;
+ }
if (!$entry->isRead()) {
$needFeedCacheRefresh = true; //Maybe
@@ -674,13 +685,17 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
continue;
}
- $entry->applyFilterActions(array_merge($titlesAsRead, $categoriesEntriesTitle[$feed->categoryId()] ?? []));
+ $entry->applyFilterActions(array_merge($titlesAsRead, $categoriesEntriesTitle[$feed->categoryId()] ?? []),
+ $categoriesEntriesGuid[$feed->categoryId()] ?? []);
if ($readWhenSameTitleInFeed > 0) {
$titlesAsRead[$entry->title()] = true;
}
if (isset($categoriesEntriesTitle[$feed->categoryId()])) {
$categoriesEntriesTitle[$feed->categoryId()][$entry->title()] = true;
}
+ if (isset($categoriesEntriesGuid[$feed->categoryId()])) {
+ $categoriesEntriesGuid[$feed->categoryId()][$entry->guid()] = true;
+ }
$needFeedCacheRefresh = true;
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index a38657505..d9adfa4ed 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -465,6 +465,20 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
return $res;
}
+ /** @return list<string> */
+ public function listGuids(int $id, int $limit = 0): array {
+ $sql = <<<'SQL'
+ SELECT e.guid FROM `_entry` e
+ INNER JOIN `_feed` f ON e.id_feed=f.id
+ WHERE f.category=:id_category
+ ORDER BY e.id DESC
+ SQL;
+ $sql .= ($limit < 1 ? '' : ' LIMIT ' . intval($limit));
+ $res = $this->fetchColumn($sql, 0, [':id_category' => $id]) ?? [];
+ /** @var list<string> $res */
+ return $res;
+ }
+
/**
* @param array<array{c_name:string,c_id:int,c_kind:int,c_last_update:int,c_error:int|bool,c_attributes?:string,
* id?:int,name?:string,url?:string,kind?:int,website?:string,priority?:int,
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index a4e51a486..647861ad5 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -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);
diff --git a/app/i18n/cs/conf.php b/app/i18n/cs/conf.php
index 850018d57..dea5e1a1a 100644
--- a/app/i18n/cs/conf.php
+++ b/app/i18n/cs/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'když se již nenachází v upstreamu zpráv.',
'upon_reception' => 'po obdržení článku',
'when' => 'Označit článek jako přečtený…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'když shodný název již existuje v top <i>n</i> nejnovějších článcích (of the feed)', // DIRTY
),
diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php
index 78ccde1ab..ad87e9d31 100644
--- a/app/i18n/de/conf.php
+++ b/app/i18n/de/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'wenn der Artikel nicht mehr im Feed enthalten ist',
'upon_reception' => 'beim Empfang des Artikels',
'when' => 'Artikel als gelesen markieren…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'falls der identische Titel bereits in den <i>n</i> neusten Artikel in der Kategorie vorhanden ist.',
'when_same_title_in_feed' => 'falls der identische Titel bereits in den <i>n</i> neusten Artikel (im Feed) vorhanden ist.',
),
diff --git a/app/i18n/el/conf.php b/app/i18n/el/conf.php
index 23d74faaf..3d429d971 100644
--- a/app/i18n/el/conf.php
+++ b/app/i18n/el/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'when it is no longer in the upstream news feed', // TODO
'upon_reception' => 'upon receiving the article', // TODO
'when' => 'Mark an article as read…', // TODO
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'if an identical title already exists in the top <i>n</i> newest articles of the feed', // TODO
),
diff --git a/app/i18n/en-US/conf.php b/app/i18n/en-US/conf.php
index 57adc3e55..ef7c377b4 100644
--- a/app/i18n/en-US/conf.php
+++ b/app/i18n/en-US/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'when it is no longer in the upstream news feed', // IGNORE
'upon_reception' => 'upon receiving the article', // IGNORE
'when' => 'Mark an article as read…', // IGNORE
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // IGNORE
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // IGNORE
'when_same_title_in_feed' => 'if an identical title already exists in the top <i>n</i> newest articles of the feed', // IGNORE
),
diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php
index 57bf87bc2..3f5cff47e 100644
--- a/app/i18n/en/conf.php
+++ b/app/i18n/en/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'when it is no longer in the upstream news feed',
'upon_reception' => 'upon receiving the article',
'when' => 'Mark an article as read…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category',
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category',
'when_same_title_in_feed' => 'if an identical title already exists in the top <i>n</i> newest articles of the feed',
),
diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.php
index d9f57f029..cc1af6c3a 100644
--- a/app/i18n/es/conf.php
+++ b/app/i18n/es/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'cuando ya no está disponible en la fuente de noticias previa',
'upon_reception' => 'al recibir el artículo',
'when' => 'Marcar el artículo como leído…',
+ 'when_same_guid_in_category' => 'si ya existe un GUID idéntico en los <i>n</i> artículos más recientes de la categoría', // DIRTY
'when_same_title_in_category' => 'si ya existe un título idéntico en los <i>n</i> artículos más recientes de la categoría',
'when_same_title_in_feed' => 'Si ya existe un título idéntico en la parte superior <i>n</i> artículos más recientes (de la fuente)',
),
diff --git a/app/i18n/fa/conf.php b/app/i18n/fa/conf.php
index 03ba57609..0d66b28b6 100644
--- a/app/i18n/fa/conf.php
+++ b/app/i18n/fa/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => ' زمانی که دیگر در فید اخبار بالادستی نیست',
'upon_reception' => ' پس از دریافت مقاله',
'when' => ' علامت گذاری یک مقاله به عنوان خوانده شده…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'اگر عنوان مشابهی در بخش بالا وجود دارد <i>n</i> تازه‌ترین مقالات این دسته',
'when_same_title_in_feed' => ' اگر عنوان یکسانی از قبل در <i>n</i> جدیدترین مقالات بالا وجود داشته باشد (از فید)',
),
diff --git a/app/i18n/fi/conf.php b/app/i18n/fi/conf.php
index 7a27c7cf9..f89c7131e 100644
--- a/app/i18n/fi/conf.php
+++ b/app/i18n/fi/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'kun artikkeli ei ole enää alkuperäisessä uutissyötteessä',
'upon_reception' => 'kun artikkeli on vastaanotettu',
'when' => 'Merkitse artikkeli luetuksi…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'jos jollakin luokan <i>n</i> uusimmalla artikkelilla on sama otsikko',
'when_same_title_in_feed' => 'jos jollakin syötteen <i>n</i> uusimmalla artikkelilla on sama otsikko',
),
diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php
index 96ebd4adc..4ca2665a3 100644
--- a/app/i18n/fr/conf.php
+++ b/app/i18n/fr/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'lorsqu’il n’est plus dans le flux d’actualités en amont',
'upon_reception' => 'dès la réception du nouvel article',
'when' => 'Marquer un article comme lu…',
+ 'when_same_guid_in_category' => 'si un même GUID existe déjà dans les <i>n</i> articles plus récents de la catégorie',
'when_same_title_in_category' => 'si un même titre existe déjà dans les <i>n</i> articles plus récents de la catégorie',
'when_same_title_in_feed' => 'si un même titre existe déjà dans les <i>n</i> articles plus récents du flux',
),
diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.php
index 405fc72ff..0b8d4a4c5 100644
--- a/app/i18n/he/conf.php
+++ b/app/i18n/he/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'when it is no longer in the upstream news feed', // TODO
'upon_reception' => 'כאשר המאמר מתקבל',
'when' => 'סימון מאמרים כנקראו…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'if an identical title already exists in the top <i>n</i> newest articles of the feed', // TODO
),
diff --git a/app/i18n/hu/conf.php b/app/i18n/hu/conf.php
index 4db0a74a2..f9368e9a1 100644
--- a/app/i18n/hu/conf.php
+++ b/app/i18n/hu/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'ha már nincs benne a hírforrásban',
'upon_reception' => 'a cikk beérkezésekor',
'when' => 'Jelöljön meg egy cikket olvasottként…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'ha már létezik azonos cím a <i>n</i> kategória legfrissebb cikkeiben',
'when_same_title_in_feed' => 'ha egy azonos című cikk már létezik a legújabb <i>n</i> számú cikk között (a hírforrásban)',
),
diff --git a/app/i18n/id/conf.php b/app/i18n/id/conf.php
index 6dfa8fa22..a9c72a89d 100644
--- a/app/i18n/id/conf.php
+++ b/app/i18n/id/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'saat artikel hilang dari umpan situs aslinya',
'upon_reception' => 'saat menerima artikel',
'when' => 'Tandai artikel sebagai sudah dibaca…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'jika judul yang identik sudah ada di <i>n</i> artikel terbaru dalam kategori',
'when_same_title_in_feed' => 'jika judul yang identik sudah ada di <i>n</i> artikel terbaru dari umpan',
),
diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php
index 18e79d3be..3b7eddd57 100644
--- a/app/i18n/it/conf.php
+++ b/app/i18n/it/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'quando non si trova più nel feed di notizie in alto',
'upon_reception' => 'Alla ricezione del contenuto',
'when' => 'Segna articoli come letti…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'se un titolo identico esiste già nei primi <i>n</i> articoli più recenti della categoria',
'when_same_title_in_feed' => 'se un titolo identico esiste già tra i <i>n</i> articoli più recenti (del feed)',
),
diff --git a/app/i18n/ja/conf.php b/app/i18n/ja/conf.php
index cb101c85a..083c695b2 100644
--- a/app/i18n/ja/conf.php
+++ b/app/i18n/ja/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'ニュースフィードの提供元がなくなったとき',
'upon_reception' => '記事を受け取ったとき',
'when' => '記事を既読にする…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'すでに同一タイトルがカテゴリ内上位<i>n</i>件の最新記事に存在するとき',
'when_same_title_in_feed' => 'すでに同一タイトルがフィード内上位<i>n</i>件の最新記事に存在するとき',
),
diff --git a/app/i18n/ko/conf.php b/app/i18n/ko/conf.php
index 918c37759..60ebc621a 100644
--- a/app/i18n/ko/conf.php
+++ b/app/i18n/ko/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => '원본 뉴스 피드에서 글 삭제 되었을 때',
'upon_reception' => '글을 가져오자마자',
'when' => '읽음으로 표시…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => '상위 <i>n</i>개의 최신 글에 동일한 제목이 이미 있는 경우 (of the feed)', // DIRTY
),
diff --git a/app/i18n/lv/conf.php b/app/i18n/lv/conf.php
index 4c7579168..80ca1097d 100644
--- a/app/i18n/lv/conf.php
+++ b/app/i18n/lv/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'kad tas vairs nav augšupējā ziņu barotnē',
'upon_reception' => 'pēc raksta saņemšanas',
'when' => 'Atzīmēt rakstu kā izlasītu…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'ja identisks virsraksts jau ir jaunākajos <i>n</i> rakstos (of the feed)', // DIRTY
),
diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php
index 0057223f8..88643d115 100644
--- a/app/i18n/nl/conf.php
+++ b/app/i18n/nl/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'als het niet langer in de nieuwsfeed staat',
'upon_reception' => 'bij ontvangst van het artikel',
'when' => 'Markeer artikel als gelezen…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'als een identieke titel al voorkomt in de top <i>n</i> nieuwste artikelen van de categorie',
'when_same_title_in_feed' => 'als een zelfde titel al voorkomt in de top <i>n</i> nieuwste artikelen (of the feed)', // DIRTY
),
diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.php
index 9e042fd8a..f917fa35b 100644
--- a/app/i18n/oc/conf.php
+++ b/app/i18n/oc/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'quand es pas mai dins lo flux de novèla font',
'upon_reception' => 'en recebre un article novèl',
'when' => 'Marcar un article coma legit…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'se un títol identic existís ja demest lo <i>n</i> articles mai recents (of the feed)', // DIRTY
),
diff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.php
index 4f4531e33..e40045f3b 100644
--- a/app/i18n/pl/conf.php
+++ b/app/i18n/pl/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'gdy nie jest już wyświetlana w źródle kanału',
'upon_reception' => 'po otrzymaniu wiadomości',
'when' => 'Oznacz wiadomość jako przeczytaną…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'gdy identyczny tytuł już istnieje w <i>n</i> najnowszych wiadomościach kategorii',
'when_same_title_in_feed' => 'gdy identyczny tytuł już istnieje w <i>n</i> najnowszych wiadomościach (kanału RSS)',
),
diff --git a/app/i18n/pt-BR/conf.php b/app/i18n/pt-BR/conf.php
index ac151ff60..9a21545fb 100644
--- a/app/i18n/pt-BR/conf.php
+++ b/app/i18n/pt-BR/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'Quando não estiver mais no feed de notícias principais',
'upon_reception' => 'ao receber um artigo',
'when' => 'Marcar artigo como lido…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'se um título idêntico já existir entre os <i>n</i> artigos mais recentes da categoria',
'when_same_title_in_feed' => 'Se um título idêntico já existir nos últimos <i>n</i> artigos mais novos (do feed)',
),
diff --git a/app/i18n/pt-PT/conf.php b/app/i18n/pt-PT/conf.php
index eacc63e3a..4a439e610 100644
--- a/app/i18n/pt-PT/conf.php
+++ b/app/i18n/pt-PT/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'Quando não estiver mais no feed de notícias principais',
'upon_reception' => 'ao receber um artigo',
'when' => 'Marcar artigo como lido…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'Se um título idêntico já existir nos últimos <i>n</i> artigos mais novos (no feed)',
),
diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php
index 0a5eefdb3..ea3db626b 100644
--- a/app/i18n/ru/conf.php
+++ b/app/i18n/ru/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'когда это больше не в новостной ленте',
'upon_reception' => 'по получении статьи',
'when' => 'Отмечать статью прочитанной…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'если идентичный заголовок уже существует среди <i>n</i> новейших статей категории',
'when_same_title_in_feed' => 'если идентичный заголовок уже существует среди <i>n</i> новейших статей ленты',
),
diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.php
index 39d6a98f8..b01aebdf8 100644
--- a/app/i18n/sk/conf.php
+++ b/app/i18n/sk/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'keď už nie je v hlavnom kanály noviniek',
'upon_reception' => 'po načítaní článku',
'when' => 'Označiť článok ako prečítaný…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => 'ak rovnaký nadpis už existuje v TOP <i>n</i> najnovších článkoch (of the feed)', // DIRTY
),
diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php
index ebe90951b..9d09d3ea6 100644
--- a/app/i18n/tr/conf.php
+++ b/app/i18n/tr/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'artık上游 haber akışında olmadığında',
'upon_reception' => 'makale alındığında',
'when' => 'Bir makaleyi okundu olarak işaretle…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'eğer aynı başlık kategorideki en yeni <i>n</i> makalede zaten varsa',
'when_same_title_in_feed' => 'eğer aynı başlık beslemedeki en yeni <i>n</i> makalede zaten varsa',
),
diff --git a/app/i18n/uk/conf.php b/app/i18n/uk/conf.php
index 9953c91a7..d1c2b3c2d 100644
--- a/app/i18n/uk/conf.php
+++ b/app/i18n/uk/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => 'коли статті більше нема в оригінальній стрічці новин',
'upon_reception' => 'при отриманні статті',
'when' => 'Позначити статтю прочитаною…',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'якщо котрась зі стількох найновіших статей категорії має такий самий заголовок',
'when_same_title_in_feed' => 'якщо котрась зі стількох найновіших статей стрічки має такий самий заголовок',
),
diff --git a/app/i18n/zh-CN/conf.php b/app/i18n/zh-CN/conf.php
index f8eb23e51..a2fbf4008 100644
--- a/app/i18n/zh-CN/conf.php
+++ b/app/i18n/zh-CN/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => '在被原订阅源被移除后',
'upon_reception' => '在接收文章后',
'when' => '何时将文章标记为已读',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => '如果分类中已经存在相同标题的最新 <i>n</i> 篇文章',
'when_same_title_in_feed' => '如果订阅源中已经存在相同标题的最新 <i>n</i> 篇文章',
),
diff --git a/app/i18n/zh-TW/conf.php b/app/i18n/zh-TW/conf.php
index 907862e3f..a8092f81b 100644
--- a/app/i18n/zh-TW/conf.php
+++ b/app/i18n/zh-TW/conf.php
@@ -280,6 +280,7 @@ return array(
'upon_gone' => '在被原訂閱源移除後',
'upon_reception' => '在接收文章後',
'when' => '何時將文章標記為已讀',
+ 'when_same_guid_in_category' => 'if an identical GUID already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_category' => 'if an identical title already exists in the top <i>n</i> newest articles of the category', // TODO
'when_same_title_in_feed' => '已存在 n 條相同標題文章 (of the feed)', // DIRTY
),
diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml
index 5106c522e..671b83640 100644
--- a/app/views/helpers/category/update.phtml
+++ b/app/views/helpers/category/update.phtml
@@ -134,6 +134,20 @@
</div>
</div>
+ <div class="form-group">
+ <label class="group-name" for="enable_read_when_same_guid_in_category"><?= _t('conf.reading.read.when') ?></label>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_read_when_same_guid_in_category">
+ <input type="checkbox" name="enable_read_when_same_guid_in_category" id="enable_read_when_same_guid_in_category" value="1"<?=
+ $this->category->hasAttribute('read_when_same_guid_in_category') ? ' checked="checked"' : '' ?> />
+ <?= _t('conf.reading.read.when_same_guid_in_category') ?>
+ <?php $read_when_same_guid_in_category = $this->category->hasAttribute('read_when_same_guid_in_category') ? $this->category->attributeInt('read_when_same_guid_in_category') : 25; ?>
+ <input type="number" id="read_when_same_guid_in_category" name="read_when_same_guid_in_category" min="0"
+ value="<?= $read_when_same_guid_in_category ?>" />
+ </label>
+ </div>
+ </div>
+
<div class="form-group">
<label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label>
<div class="group-controls">
diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md
index 9488a4d48..b333bd62d 100644
--- a/docs/en/developers/03_Backend/05_Extensions.md
+++ b/docs/en/developers/03_Backend/05_Extensions.md
@@ -181,7 +181,7 @@ Example response for a `query_icon_info` request:
* `Minz_HookType::CustomFaviconHash` (`function(FreshRSS_Feed $feed): string | null`): Enables the modification of custom favicon hashes by returning params from the hook function. The hook should check if the `customFaviconExt` attribute of `$feed` is set to the extension's name before returning a custom value. Otherwise, the return value should be null.
* `Minz_HookType::EntriesFavorite` (`function(array $ids, bool $is_favorite): void`):
will be executed when some entries are marked or unmarked as favorites (starred)
-* `Minz_HookType::EntryAutoRead` (`function(FreshRSS_Entry $entry, string $why): void`): Triggered when an entry is automatically marked as read. The *why* parameter supports the rules {`filter`, `upon_reception`, `same_title_in_feed`}.
+* `Minz_HookType::EntryAutoRead` (`function(FreshRSS_Entry $entry, string $why): void`): Triggered when an entry is automatically marked as read. The *why* parameter supports the rules {`filter`, `upon_reception`, `same_title_in_feed`, `same_guid_in_category`}.
* `Minz_HookType::EntryAutoUnread` (`function(FreshRSS_Entry $entry, string $why): void`): Triggered when an entry is automatically marked as unread. The *why* parameter supports the rules {`updated_article`}.
* `Minz_HookType::EntryBeforeDisplay` (`function($entry) -> Entry | null`): will be executed every time an entry is rendered. The entry itself (instance of FreshRSS\_Entry) will be passed as parameter.
* `Minz_HookType::EntryBeforeInsert` (`function($entry) -> Entry | null`): will be executed when a feed is refreshed and new entries will be imported into the database. The new entry (instance of FreshRSS\_Entry) will be passed as parameter.
diff --git a/docs/fr/developers/03_Backend/05_Extensions.md b/docs/fr/developers/03_Backend/05_Extensions.md
index 75140891e..17e6cfca6 100644
--- a/docs/fr/developers/03_Backend/05_Extensions.md
+++ b/docs/fr/developers/03_Backend/05_Extensions.md
@@ -228,7 +228,7 @@ The following events are available:
parameter. This way a website known to have feeds which doesn’t advertise
it in the header can still be automatically supported.
* `entry_auto_read` (`function(FreshRSS_Entry $entry, string $why): void`):
- Appelé lorsqu’une entrée est automatiquement marquée comme lue. Le paramètre *why* supporte les règles {`filter`, `upon_reception`, `same_title_in_feed`}.
+ Appelé lorsqu’une entrée est automatiquement marquée comme lue. Le paramètre *why* supporte les règles {`filter`, `upon_reception`, `same_title_in_feed`, `same_guid_in_category`}.
* `entry_auto_unread` (`function(FreshRSS_Entry $entry, string $why): void`):
Appelé lorsqu’une entrée est automatiquement marquée comme non-lue. Le paramètre *why* supporte les règles {`updated_article`}.
* `entry_before_display` (`function($entry) -> Entry | null`): will be