From 02f08111cfa075f1bf718f168baba4157821f33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 26 Feb 2021 22:22:12 -0500 Subject: [PATCH] feat: keep notifs for one month, load 50 notifications instead of 30 --- src/notifications.js | 4 ++-- src/user/notifications.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/notifications.js b/src/notifications.js index 66162c935a..4c27ad1a79 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -318,8 +318,8 @@ Notifications.markAllRead = async function (uid) { }; Notifications.prune = async function () { - const week = 604800000; - const cutoffTime = Date.now() - week; + const month = 2592000000; + const cutoffTime = Date.now() - month; const nids = await db.getSortedSetRangeByScore('notifications', 0, 500, '-inf', cutoffTime); if (!nids.length) { return; diff --git a/src/user/notifications.js b/src/user/notifications.js index a6116c3cb1..b7be8262d0 100644 --- a/src/user/notifications.js +++ b/src/user/notifications.js @@ -18,11 +18,11 @@ UserNotifications.get = async function (uid) { return { read: [], unread: [] }; } - let unread = await getNotificationsFromSet(`uid:${uid}:notifications:unread`, uid, 0, 29); + let unread = await getNotificationsFromSet(`uid:${uid}:notifications:unread`, uid, 0, 49); unread = unread.filter(Boolean); let read = []; - if (unread.length < 30) { - read = await getNotificationsFromSet(`uid:${uid}:notifications:read`, uid, 0, 29 - unread.length); + if (unread.length < 50) { + read = await getNotificationsFromSet(`uid:${uid}:notifications:read`, uid, 0, 49 - unread.length); } return await plugins.hooks.fire('filter:user.notifications.get', {