From 64133d7e019581a653e4072d9a26f2636c36dbdf Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sun, 23 Feb 2025 14:21:52 +0900 Subject: [PATCH] refactor --- packages/backend/src/core/DeleteAccountService.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/DeleteAccountService.ts b/packages/backend/src/core/DeleteAccountService.ts index 9bd3df2c4a..ff1bb9c600 100644 --- a/packages/backend/src/core/DeleteAccountService.ts +++ b/packages/backend/src/core/DeleteAccountService.ts @@ -46,10 +46,8 @@ export class DeleteAccountService { const _user = await this.usersRepository.findOneByOrFail({ id: user.id }); const systemAccounts = await this.systemAccountService.list(); - for (const systemAccount of systemAccounts) { - if (systemAccount.userId === user.id) { - throw new Error('cannot delete a system account'); - } + if (systemAccounts.some(x => x.id === user.id)) { + throw new Error('cannot delete a system account'); } if (moderator != null) {