diff --git a/src/api/friends/OpenMessengerChat.ts b/src/api/friends/OpenMessengerChat.ts index 0b8ab554..37e0bc3c 100644 --- a/src/api/friends/OpenMessengerChat.ts +++ b/src/api/friends/OpenMessengerChat.ts @@ -1,7 +1,7 @@ import { CreateLinkEvent } from '..'; -export function OpenMessengerChat(friendId: number = -1): void +export function OpenMessengerChat(friendId: number = 0): void { - if(friendId === -1) CreateLinkEvent('friends/messenger/open'); + if(friendId === 0) CreateLinkEvent('friends/messenger/open'); else CreateLinkEvent(`friends/messenger/${friendId}`); } diff --git a/src/components/friends/views/messenger/FriendsMessengerThreadGroup.tsx b/src/components/friends/views/messenger/FriendsMessengerThreadGroup.tsx index 83bc054a..a9adf7d8 100644 --- a/src/components/friends/views/messenger/FriendsMessengerThreadGroup.tsx +++ b/src/components/friends/views/messenger/FriendsMessengerThreadGroup.tsx @@ -62,9 +62,7 @@ export const FriendsMessengerThreadGroup: FC = - { - (isOwnChat) && GetSessionDataManager().userName - } + { (isOwnChat) && GetSessionDataManager().userName } { (!isOwnChat) && ((group.type === GroupType.GROUP_CHAT) ? getGroupChatData(group.chats[0].extraData).username : thread.participant.name) } diff --git a/src/components/friends/views/messenger/FriendsMessengerView.tsx b/src/components/friends/views/messenger/FriendsMessengerView.tsx index 52befb9b..c56e282e 100644 --- a/src/components/friends/views/messenger/FriendsMessengerView.tsx +++ b/src/components/friends/views/messenger/FriendsMessengerView.tsx @@ -212,6 +212,8 @@ export const FriendsMessengerView: FC<{}> = props => const activeThread = messageThreads[activeThreadIndex]; + if(!activeThread) return; + if(activeThread.unread) { messagesBox.current.scrollTop = messagesBox.current.scrollHeight; @@ -281,7 +283,7 @@ export const FriendsMessengerView: FC<{}> = props => - { (activeThreadIndex >= 0) && + { visibleThreads && (visibleThreads.length > 0) && (activeThreadIndex >= 0) && <> { LocalizeText('messenger.window.separator', [ 'FRIEND_NAME' ], [ messageThreads[activeThreadIndex].participant.name ]) }