This commit is contained in:
2026-09-29 04:35:35 +02:00
parent 73c0659d4a
commit 6c813143eb
51 changed files with 3708 additions and 743 deletions
+9 -4
View File
@@ -3873,19 +3873,24 @@
}
});
// Mark all read
// Mark all read (current tab only)
if (sMarkAll) {
sMarkAll.addEventListener('click', async () => {
try {
const tab = sActiveTab || 'user';
const csrfToken = window.f0ckSession?.csrf_token || window.scrollerCsrf || '';
await fetch('/api/notifications/read', {
await fetch('/api/notifications/read?tab=' + encodeURIComponent(tab), {
method: 'POST',
headers: { ...(csrfToken ? { 'X-CSRF-Token': csrfToken } : {}) }
});
updateScrollerNotifBadge(0);
sCachedNotifs = sCachedNotifs.map(n => ({ ...n, is_read: true }));
// Mark only the active tab's cached notifications as read
const tabCheck = tab === 'user' ? isUserType : (tab === 'system' ? isSystemType : () => false);
sCachedNotifs = sCachedNotifs.map(n => tabCheck(n.type) ? { ...n, is_read: true } : n);
updateScrollerTabBadges(sCachedNotifs);
renderScrollerNotifs(filterByTab(sCachedNotifs, sActiveTab));
// Update overall badge
const totalUnread = sCachedNotifs.filter(n => !n.is_read).length;
updateScrollerNotifBadge(totalUnread);
} catch (e) {}
});
}