summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2024-10-14 15:52:02 +0000
committerHazelnoot <acomputerdog@gmail.com>2024-10-14 15:52:02 +0000
commitb15f25758a2b33aa9b9136f005c805617a2f650a (patch)
tree1c9c375ab2743a339ee8b8b7b80a7839fd3e4434 /packages/backend/src/core
parentmerge: try to avoid `insert` races in `FederatedInstanceService` (!683) (diff)
parentrestore missing hasPendingReceivedFollowRequest in navbar (diff)
downloadsharkey-b15f25758a2b33aa9b9136f005c805617a2f650a.tar.gz
sharkey-b15f25758a2b33aa9b9136f005c805617a2f650a.tar.bz2
sharkey-b15f25758a2b33aa9b9136f005c805617a2f650a.zip
merge: feat: Allow users to view pending follow requests they sent (!663)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/663 Approved-by: Hazelnoot <acomputerdog@gmail.com> Approved-by: Marie <github@yuugi.dev>
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/entities/UserEntityService.ts8
1 files changed, 8 insertions, 0 deletions
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
@@ -375,6 +375,13 @@ export class UserEntityService implements OnModuleInit {
}
@bindThis
+ public async getHasPendingSentFollowRequest(userId: MiUser['id']): Promise<boolean> {
+ return this.followRequestsRepository.existsBy({
+ followerId: userId,
+ });
+ }
+
+ @bindThis
public getOnlineStatus(user: MiUser): 'unknown' | 'online' | 'active' | 'offline' {
if (user.hideOnlineStatus) return 'unknown';
if (user.lastActiveDate == null) 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,