From db5763fbfc0390d64ad2866be27c1d947e3a9934 Mon Sep 17 00:00:00 2001 From: Tenari Date: Mon, 31 Jul 2023 10:47:46 -0500 Subject: [PATCH] RE-309 pr changes --- .../apps/Courier/components/ChatMessage.tsx | 12 +++--------- .../apps/Courier/views/ChatLog/ChatLog.tsx | 18 +++++++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/src/renderer/apps/Courier/components/ChatMessage.tsx b/app/src/renderer/apps/Courier/components/ChatMessage.tsx index b448ab68a7..2737f872f7 100644 --- a/app/src/renderer/apps/Courier/components/ChatMessage.tsx +++ b/app/src/renderer/apps/Courier/components/ChatMessage.tsx @@ -410,7 +410,7 @@ export const ChatMessagePresenter = ({ ] ); - const chatJoiner = useCallback( + const onJoinChatClick = useCallback( (path: string, host?: string) => { const chat = chatStore.inbox.find((i) => i.path === path); if (chat) { @@ -421,13 +421,7 @@ export const ChatMessagePresenter = ({ } chatStore.setSubroute('inbox'); - ( - ChatIPC.addPeerToChat( - path, - loggedInAccount.serverId, - host - ) as Promise - ) + ChatIPC.addPeerToChat(path, loggedInAccount.serverId, host) .then(() => { console.log('joining chat', path); }) @@ -468,7 +462,7 @@ export const ChatMessagePresenter = ({ onReaction={canReact ? onReaction : undefined} onReplyClick={onReplyClick} onJoinSpaceClick={joiner} - onJoinChatClick={chatJoiner} + onJoinChatClick={onJoinChatClick} allSpacePaths={spacesStore.allSpacePaths} allChatPaths={chatStore.allChatPaths} error={message.error} diff --git a/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx b/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx index 2c69a54828..6adc0f9029 100644 --- a/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx +++ b/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx @@ -107,7 +107,7 @@ export const ChatLogPresenter = ({ isStandaloneChat = false }: Props) => { if (!selectedChat) return; const measuredFrags = await Promise.all( fragments.map(async (frag) => { - let metadata: object | string = {}; + let metadata: { [key: string]: string } = {}; if (Object.keys(frag)[0] === 'image') { const { width, height } = await measureImage( frag.image, @@ -144,15 +144,19 @@ export const ChatLogPresenter = ({ isStandaloneChat = false }: Props) => { const match = spacesStore.getSpaceByPath( cust.value.replace(/^\/spaces/, '') ); - metadata = { - space: match && JSON.stringify(match), - }; + if (match) { + metadata = { + space: JSON.stringify(match), + }; + } } if (cust.name === 'realm-chat') { const match = inbox.find((i) => i.path === cust.value); - metadata = { - chat: match && JSON.stringify(match), - }; + if (match) { + metadata = { + chat: JSON.stringify(match), + }; + } } } return {