From 1304a9fbb5be1bd07ad65cc4f90a4a003dde5192 Mon Sep 17 00:00:00 2001 From: taichan Date: Tue, 20 Feb 2024 14:28:28 +0900 Subject: [PATCH] Revert API handling --- .../api/endpoints/i/notifications-grouped.ts | 23 ------------------- .../server/api/endpoints/i/notifications.ts | 23 ------------------- 2 files changed, 46 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/notifications-grouped.ts b/packages/backend/src/server/api/endpoints/i/notifications-grouped.ts index d688c71cd5..c465e75944 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications-grouped.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications-grouped.ts @@ -110,29 +110,6 @@ export default class extends Endpoint { // eslint- notifications = notifications.filter(notification => !excludeTypes.includes(notification.type)); } - //#region Check muting - - const [ - userIdsWhoMeMuting, - userMutedInstances, - ] = await Promise.all([ - this.cacheService.userMutingsCache.fetch(me.id), - this.cacheService.userProfileCache.fetch(me.id).then(p => new Set(p.mutedInstances)), - ]); - - notifications = (await Promise.all(notifications.map(async (notification): Promise => { - if (!('notifierId' in notification)) return notification; - if (userIdsWhoMeMuting.has(notification.notifierId)) return null; - - const notifier = await this.usersRepository.findOneBy({ id: notification.notifierId }); - if (notifier === null) return null; - if (notifier.host && userMutedInstances.has(notifier.host)) return null; - - return notification; - }))).filter((notification): notification is MiNotification => notification !== null); - - //#endregion Check muting - if (notifications.length === 0) { return []; } diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 3714bbeac0..c738d90509 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -108,29 +108,6 @@ export default class extends Endpoint { // eslint- notifications = notifications.filter(notification => !excludeTypes.includes(notification.type)); } - //#region Check muting - - const [ - userIdsWhoMeMuting, - userMutedInstances, - ] = await Promise.all([ - this.cacheService.userMutingsCache.fetch(me.id), - this.cacheService.userProfileCache.fetch(me.id).then(p => new Set(p.mutedInstances)), - ]); - - notifications = (await Promise.all(notifications.map(async (notification): Promise => { - if (!('notifierId' in notification)) return notification; - if (userIdsWhoMeMuting.has(notification.notifierId)) return null; - - const notifier = await this.usersRepository.findOneBy({ id: notification.notifierId }); - if (notifier === null) return null; - if (notifier.host && userMutedInstances.has(notifier.host)) return null; - - return notification; - }))).filter((notification): notification is MiNotification => notification !== null); - - //#endregion Check muting - if (notifications.length === 0) { return []; }