feat: do not consider notifications older than 1 week for unread sign
This commit is contained in:
parent
f27f85b418
commit
ab15930780
1 changed files with 5 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue