@@ -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+
99101UserNotifications . getNotifications = async function ( nids , uid ) {
100102 if ( ! Array . isArray ( nids ) || ! nids . length ) {
101103 return [ ] ;
0 commit comments