Skip to content

Commit

Permalink
RE-309 pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenari committed Jul 31, 2023
1 parent 60271aa commit db5763f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
12 changes: 3 additions & 9 deletions app/src/renderer/apps/Courier/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -421,13 +421,7 @@ export const ChatMessagePresenter = ({
}
chatStore.setSubroute('inbox');

(
ChatIPC.addPeerToChat(
path,
loggedInAccount.serverId,
host
) as Promise<void>
)
ChatIPC.addPeerToChat(path, loggedInAccount.serverId, host)
.then(() => {
console.log('joining chat', path);
})
Expand Down Expand Up @@ -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}
Expand Down
18 changes: 11 additions & 7 deletions app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit db5763f

Please sign in to comment.