aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-07-30 12:01:59 +0200
committerGravatar GitHub <noreply@github.com> 2024-07-30 12:01:59 +0200
commit5659b37948c17e5e68971a2464930bee3455dfa1 (patch)
tree73cf14f73db93705489f9172f5241dececcc9c49 /app/Models/Feed.php
parent5c8369ce38c67fba7dd39d68626534c7e61eb24c (diff)
Fix markAsReadUponGone regression (#6663)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5470 Was not working anymore when the feed was empty. Plus simplification of the logic when the feed is not empty
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index e9d031a82..731f82d14 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -843,7 +843,7 @@ class FreshRSS_Feed extends Minz_Model {
* Remember to call `updateCachedValues($id_feed)` or `updateCachedValues()` just after.
* @return int|false the number of lines affected, or false if not applicable
*/
- public function markAsReadUponGone(bool $upstreamIsEmpty, int $maxTimestamp = 0) {
+ public function markAsReadUponGone(bool $upstreamIsEmpty, int $minLastSeen = 0) {
$readUponGone = $this->attributeBoolean('read_upon_gone');
if ($readUponGone === null) {
$readUponGone = FreshRSS_Context::userConf()->mark_when['gone'];
@@ -852,14 +852,14 @@ class FreshRSS_Feed extends Minz_Model {
return false;
}
if ($upstreamIsEmpty) {
- if ($maxTimestamp <= 0) {
- $maxTimestamp = time();
+ if ($minLastSeen <= 0) {
+ $minLastSeen = time();
}
$entryDAO = FreshRSS_Factory::createEntryDao();
- $affected = $entryDAO->markReadFeed($this->id(), $maxTimestamp . '000000');
+ $affected = $entryDAO->markReadFeed($this->id(), $minLastSeen . '000000');
} else {
$feedDAO = FreshRSS_Factory::createFeedDao();
- $affected = $feedDAO->markAsReadUponGone($this->id());
+ $affected = $feedDAO->markAsReadNotSeen($this->id(), $minLastSeen);
}
if ($affected > 0) {
Minz_Log::debug(__METHOD__ . " $affected items" . ($upstreamIsEmpty ? ' (all)' : '') . ' [' . $this->url(false) . ']');