summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/i/notifications.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-06-01 13:28:43 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-06-01 13:28:43 +0900
commitec2f05d4f79d8f9b1a866527d906db6a2a2b5ba7 (patch)
tree70486436804bc688c5cff3f4422e875f0b8a194a /packages/backend/src/server/api/endpoints/i/notifications.ts
parentNew translations ja-JP.yml (Korean) (#10933) (diff)
downloadsharkey-ec2f05d4f79d8f9b1a866527d906db6a2a2b5ba7.tar.gz
sharkey-ec2f05d4f79d8f9b1a866527d906db6a2a2b5ba7.tar.bz2
sharkey-ec2f05d4f79d8f9b1a866527d906db6a2a2b5ba7.zip
fix(backend): i/notificationsのsinceIdが機能しない問題を修正
Fix #10902
Diffstat (limited to 'packages/backend/src/server/api/endpoints/i/notifications.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/i/notifications.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts
index e141be764a..f5662f4a0e 100644
--- a/packages/backend/src/server/api/endpoints/i/notifications.ts
+++ b/packages/backend/src/server/api/endpoints/i/notifications.ts
@@ -91,18 +91,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const includeTypes = ps.includeTypes && ps.includeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
const excludeTypes = ps.excludeTypes && ps.excludeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
- const limit = ps.limit + (ps.untilId ? 1 : 0); // untilIdに指定したものも含まれるため+1
+ const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1
const notificationsRes = await this.redisClient.xrevrange(
`notificationTimeline:${me.id}`,
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+',
- '-',
+ ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : '-',
'COUNT', limit);
if (notificationsRes.length === 0) {
return [];
}
- let notifications = notificationsRes.map(x => JSON.parse(x[1][1])).filter(x => x.id !== ps.untilId) as Notification[];
+ let notifications = notificationsRes.map(x => JSON.parse(x[1][1])).filter(x => x.id !== ps.untilId && x !== ps.sinceId) as Notification[];
if (includeTypes && includeTypes.length > 0) {
notifications = notifications.filter(notification => includeTypes.includes(notification.type));