From 065b889ccbf5fcd11b03469c27b8a6fb5fec90b8 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Tue, 5 Sep 2023 18:34:58 -0400 Subject: [PATCH] refactor: constrain type --- .../src/server/api/endpoints/i/notifications.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 14c44e62ad..f74a5f0ed1 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -132,11 +132,11 @@ export default define(meta, paramDef, async (ps, user) => { blockerIds.includes(n.notifierId)) ), ); - if ( - ps.directOnly && - ps.includeTypes?.every((t) => ["mention", "reply"].includes(t)) - ) { - filtered = filtered.filter(({ entityId }) => !!entityId); + if (ps.directOnly) { + filtered = filtered.filter( + ({ entityId, type }) => + entityId && ["mention", "reply"].includes(type), + ); let notes = await client .execute( prepared.note.select.byIds,