Skip to content

Commit aa6f7e6

Browse files
committed
Added P1A
1 parent d1da83e commit aa6f7e6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/user/notifications.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ UserNotifications.get = async function (uid) {
2020
return { read: [], unread: [] };
2121
}
2222

23-
let unread = await getNotificationsFromSet(`uid:${uid}:notifications:unread`, uid, 0, 49);
23+
let unread = await getNotificationsFromSet(`uid:${uid}:notifications:unread`, uid, { start: 0, stop: 49 });
2424
unread = unread.filter(Boolean);
2525
let read = [];
2626
if (unread.length < 50) {
2727
read = await getNotificationsFromSet(`uid:${uid}:notifications:read`, uid, 0, 49 - unread.length);
28+
read = await getNotificationsFromSet(`uid:${uid}:notifications:read`, uid, { start: 0, stop: 49 - unread.length });
2829
}
2930

3031
return await plugins.hooks.fire('filter:user.notifications.get', {
@@ -91,11 +92,12 @@ async function deleteUserNids(nids, uid) {
9192
], nids);
9293
}
9394

94-
async function getNotificationsFromSet(set, uid, start, stop) {
95-
const nids = await db.getSortedSetRevRange(set, start, stop);
95+
async function getNotificationsFromSet(set, uid, range) {
96+
const nids = await db.getSortedSetRevRange(set, range.start, range.stop);
9697
return await UserNotifications.getNotifications(nids, uid);
9798
}
9899

100+
99101
UserNotifications.getNotifications = async function (nids, uid) {
100102
if (!Array.isArray(nids) || !nids.length) {
101103
return [];

0 commit comments

Comments
 (0)