From 0e6ba9ccd4b7165ad125d1e94365026e87da4254 Mon Sep 17 00:00:00 2001 From: Lhc_fl Date: Sun, 6 Oct 2024 19:12:13 +0800 Subject: ux: should not show follow requests tab when have no pending sent follow req --- packages/backend/src/core/entities/UserEntityService.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/backend/src/core') diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index d465e2cd4c..fc66f7a507 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -374,6 +374,13 @@ export class UserEntityService implements OnModuleInit { return count > 0; } + @bindThis + public async getHasPendingSentFollowRequest(userId: MiUser['id']): Promise { + return this.followRequestsRepository.existsBy({ + followerId: userId, + }); + } + @bindThis public getOnlineStatus(user: MiUser): 'unknown' | 'online' | 'active' | 'offline' { if (user.hideOnlineStatus) return 'unknown'; @@ -642,6 +649,7 @@ export class UserEntityService implements OnModuleInit { hasUnreadChannel: false, // 後方互換性のため hasUnreadNotification: notificationsInfo?.hasUnread, // 後方互換性のため hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id), + hasPendingSentFollowRequest: this.getHasPendingSentFollowRequest(user.id), unreadNotificationsCount: notificationsInfo?.unreadCount, mutedWords: profile!.mutedWords, hardMutedWords: profile!.hardMutedWords, -- cgit v1.2.3-freya