filterの改善

This commit is contained in:
taichanne30 2024-02-21 03:15:08 +09:00
parent a4ad66bd5b
commit 0cf8946fc7
No known key found for this signature in database
GPG Key ID: 1D5EE39F870DC283

View File

@ -222,7 +222,7 @@ export class NotificationEntityService implements OnModuleInit {
user, user,
reaction: reaction.reaction, reaction: reaction.reaction,
}; };
}))).filter(r => r.user); }))).filter(r => isNotNull(r.user));
// if all users have been deleted, don't show this notification // if all users have been deleted, don't show this notification
if (!reactions.length) { if (!reactions.length) {
return null; return null;
@ -243,7 +243,7 @@ export class NotificationEntityService implements OnModuleInit {
} }
return this.userEntityService.pack(userId, { id: meId }); return this.userEntityService.pack(userId, { id: meId });
}))).filter(u => u); }))).filter(isNotNull);
// if all users have been deleted, don't show this notification // if all users have been deleted, don't show this notification
if (!users.length) { if (!users.length) {
return null; return null;