aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-05-09 22:31:43 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-09 22:31:43 +0200
commit4c5f3bbd9b81e73316c794bd47debf1659e7723c (patch)
tree6c7e11c657fb55ee2a751a066c9bae21f5a5d407 /app/Controllers/feedController.php
parent26bc0e0ee9a23631b808e7328252cfb7865b9941 (diff)
Fix markAsReadUponGone (#5382)
Fix regression from https://github.com/FreshRSS/FreshRSS/pull/5315 which indroduced a bug for cached feeds. We now update the `lastSeen` property of entries to account for the fact that they are unchanged but still existing.
Diffstat (limited to 'app/Controllers/feedController.php')
-rw-r--r--app/Controllers/feedController.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 645175d19..fc03f7224 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -400,6 +400,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$isNewFeed = $feed->lastUpdate() <= 0;
+ $feedIsUnchanged = false;
try {
if ($simplePiePush) {
@@ -416,6 +417,10 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
} else {
$simplePie = $feed->load(false, $isNewFeed);
+ if ($simplePie === null) {
+ // Feed is cached and unchanged
+ $feedIsUnchanged = true;
+ }
}
$newGuids = $simplePie === null ? [] : $feed->loadGuids($simplePie);
$entries = $simplePie === null ? [] : $feed->loadEntries($simplePie);
@@ -525,6 +530,12 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
}
$entryDAO->updateLastSeen($feed->id(), array_keys($newGuids), $mtime);
+ } elseif ($feedIsUnchanged) {
+ // Feed cache was unchanged, so mark as seen the same entries as last time
+ if (!$entryDAO->inTransaction()) {
+ $entryDAO->beginTransaction();
+ }
+ $entryDAO->updateLastSeenUnchanged($feed->id(), $mtime);
}
unset($entries);