mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Don't show friend request button for yourself
This commit is contained in:
parent
23163a8791
commit
2cb2e59d01
@ -1,7 +1,7 @@
|
|||||||
import { AcceptFriendMessageComposer, DeclineFriendMessageComposer, FollowFriendMessageComposer, FriendListFragmentEvent, FriendListUpdateComposer, FriendListUpdateEvent, FriendParser, FriendRequestsEvent, GetFriendRequestsComposer, MessengerInitComposer, MessengerInitEvent, NewFriendRequestEvent, RequestFriendComposer, SetRelationshipStatusComposer } from '@nitrots/nitro-renderer';
|
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 { useEffect, useMemo, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
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';
|
import { useMessageEvent } from '../events';
|
||||||
|
|
||||||
const useFriendsState = () =>
|
const useFriendsState = () =>
|
||||||
@ -60,6 +60,8 @@ const useFriendsState = () =>
|
|||||||
|
|
||||||
const canRequestFriend = (userId: number) =>
|
const canRequestFriend = (userId: number) =>
|
||||||
{
|
{
|
||||||
|
if(userId === GetSessionDataManager().userId) return false;
|
||||||
|
|
||||||
if(getFriend(userId)) return false;
|
if(getFriend(userId)) return false;
|
||||||
|
|
||||||
if(requests.find(request => (request.requesterUserId === userId))) return false;
|
if(requests.find(request => (request.requesterUserId === userId))) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user