Fix friend issues

This commit is contained in:
Bill 2022-07-27 19:46:22 -04:00
parent 0a5b33ceda
commit 6a6d7f6947
3 changed files with 12 additions and 9 deletions

View File

@ -2,6 +2,6 @@ import { CreateLinkEvent } from '..';
export function OpenMessengerChat(friendId: number = 0): void
{
if(friendId === 0) CreateLinkEvent('friends-messenger/open');
if(friendId === 0) CreateLinkEvent('friends-messenger/toggle');
else CreateLinkEvent(`friends-messenger/${ friendId }`);
}

View File

@ -49,15 +49,20 @@ export const FriendsMessengerView: FC<{}> = props =>
return;
}
else
if(parts[1] === 'toggle')
{
const thread = getMessageThread(parseInt(parts[1]));
setIsVisible(prevValue => !prevValue);
if(!thread) return;
setActiveThreadId(thread.threadId);
setIsVisible(true);
return;
}
const thread = getMessageThread(parseInt(parts[1]));
if(!thread) return;
setActiveThreadId(thread.threadId);
setIsVisible(true);
}
},
eventUrlPrefix: 'friends-messenger/'

View File

@ -62,8 +62,6 @@ const useFriendRequestWidgetState = () =>
useEffect(() =>
{
if(!requests || !requests.length) return;
const newDisplayedRequests: { roomIndex: number, request: MessengerRequest }[] = [];
for(const request of requests)