1
0
forked from mirror/misskey

Revert API handling

This commit is contained in:
taichan 2024-02-20 14:28:28 +09:00
parent f0c1c08314
commit 1304a9fbb5
No known key found for this signature in database
GPG Key ID: CCE28623AFA24E9C
2 changed files with 0 additions and 46 deletions

View File

@ -110,29 +110,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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<MiNotification|null> => {
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 [];
}

View File

@ -108,29 +108,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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<MiNotification|null> => {
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 [];
}