aboutsummaryrefslogtreecommitdiff
path: root/app/layout
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-10-28 19:07:14 +0100
committerGravatar GitHub <noreply@github.com> 2025-10-28 19:07:14 +0100
commit49a92c2437d3be9fba8c6af2d3f328ae525d81c6 (patch)
treefa62707782aa152bb5f28af1a4fce863d418a0b9 /app/layout
parent6440f9c9a91160103b7c2c369761ada31926c02a (diff)
Mark as read 1 or 7 days based on publication date (#8163)
Allow the UI for marking as read articles older than 1 or 7 days to also work when sorting by publication date (in which case, the publication date is used). <img width="382" height="229" alt="image" src="https://github.com/user-attachments/assets/a630dec8-1e18-4766-8392-59fb593dd73d" />
Diffstat (limited to 'app/layout')
-rw-r--r--app/layout/nav_menu.phtml14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml
index bf6d331ee..4529d0df3 100644
--- a/app/layout/nav_menu.phtml
+++ b/app/layout/nav_menu.phtml
@@ -152,12 +152,20 @@
type="submit"><?= $string_mark ?></button>
</li>
<?php
- $mark_read_enabled = FreshRSS_Context::$sort === 'id';
+ $mark_read_enabled = in_array(FreshRSS_Context::$sort, ['id', 'date'], true);
$today = @strtotime('today');
$mark_before_today = $mark_read_url;
- $mark_before_today['params']['idMax'] = $today . '000000';
$mark_before_one_week = $mark_read_url;
- $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
+ switch (FreshRSS_Context::$sort) {
+ case 'id':
+ $mark_before_today['params']['idMax'] = $today . '000000';
+ $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
+ break;
+ case 'date':
+ $mark_before_today['params']['maxPubDate'] = $today;
+ $mark_before_one_week['params']['maxPubDate'] = $today - 604800;
+ break;
+ }
$mark_unread_enabled = FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ) ||
(!FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_OR_NOT_READ));
?>