From 8f04bacef38bc44c39c59a82f0f0b9a193548dba Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:30:35 +0900 Subject: [PATCH] refactor --- .../server/api/endpoints/charts/user/following.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/charts/user/following.ts b/packages/backend/src/server/api/endpoints/charts/user/following.ts index 15b318fa89..4462e4a5bb 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/following.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/following.ts @@ -54,20 +54,20 @@ export default class extends Endpoint { // eslint- return await this.perUserFollowingChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId); }; + if (me != null && me.id === ps.userId) { + return await done(); + } + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: ps.userId }); if (profile.followingVisibility === 'public' && profile.followersVisibility === 'public') { - done(); - } - - if (me != null && me.id === ps.userId) { - done(); + return await done(); } const iAmModerator = await this.roleService.isModerator(me); if (iAmModerator) { - done(); + return await done(); } if ( @@ -79,7 +79,7 @@ export default class extends Endpoint { // eslint- ) { const relations = await this.userEntityService.getRelation(me.id, ps.userId); if (relations.following) { - done(); + return await done(); } }