feat: do not consider notifications older than 1 week for unread sign

This commit is contained in:
siiky 2024-02-14 14:24:58 +00:00
parent f27f85b418
commit ab15930780

View file

@ -72,7 +72,11 @@ const markAllAsRead = () => {
}
const hasUnreadNotifications = () => {
const sql = `SELECT EXISTS (SELECT 1 FROM notifications WHERE read = 'f' LIMIT 1)`
const sql = `
SELECT EXISTS
(SELECT * FROM notifications
WHERE valid AND NOT read AND created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))
`
return db.oneOrNone(sql).then(res => res.exists).catch(logger.error)
}