From 2cb2e59d0164c7b289e02d50a0de1d0708e0c398 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 1 Aug 2022 13:29:38 -0400 Subject: [PATCH] Don't show friend request button for yourself --- src/hooks/friends/useFriends.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/friends/useFriends.ts b/src/hooks/friends/useFriends.ts index d14a9553..05437b2a 100644 --- a/src/hooks/friends/useFriends.ts +++ b/src/hooks/friends/useFriends.ts @@ -1,7 +1,7 @@ import { AcceptFriendMessageComposer, DeclineFriendMessageComposer, FollowFriendMessageComposer, FriendListFragmentEvent, FriendListUpdateComposer, FriendListUpdateEvent, FriendParser, FriendRequestsEvent, GetFriendRequestsComposer, MessengerInitComposer, MessengerInitEvent, NewFriendRequestEvent, RequestFriendComposer, SetRelationshipStatusComposer } from '@nitrots/nitro-renderer'; import { useEffect, useMemo, useState } from 'react'; import { useBetween } from 'use-between'; -import { CloneObject, MessengerFriend, MessengerRequest, MessengerSettings, SendMessageComposer } from '../../api'; +import { CloneObject, GetSessionDataManager, MessengerFriend, MessengerRequest, MessengerSettings, SendMessageComposer } from '../../api'; import { useMessageEvent } from '../events'; const useFriendsState = () => @@ -60,6 +60,8 @@ const useFriendsState = () => const canRequestFriend = (userId: number) => { + if(userId === GetSessionDataManager().userId) return false; + if(getFriend(userId)) return false; if(requests.find(request => (request.requesterUserId === userId))) return false;