From dc3b509c9edf9753fab87c904e7fd4174405b5d3 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Mon, 20 Feb 2023 20:01:23 +0300 Subject: [PATCH] chat-creation-hotfix --- src/components/Inbox/CreateModalContent.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/Inbox/CreateModalContent.tsx b/src/components/Inbox/CreateModalContent.tsx index 6047c51a..1b6556e4 100644 --- a/src/components/Inbox/CreateModalContent.tsx +++ b/src/components/Inbox/CreateModalContent.tsx @@ -15,34 +15,32 @@ type Props = { const CreateModalContent = (props: Props) => { const { t } = useLocalize() const inviteUsers: inviteUser[] = props.users.map((user) => ({ ...user, selected: false })) - const [theme, setTheme] = createSignal(' ') + const [chatTitle, setChatTitle] = createSignal('') const [usersId, setUsersId] = createSignal([]) const [collectionToInvite, setCollectionToInvite] = createSignal(inviteUsers) let textInput: HTMLInputElement const reset = () => { - setTheme('') + setChatTitle('') setUsersId([]) hideModal() } createEffect(() => { setUsersId(() => { - return collectionToInvite() + const s = collectionToInvite() .filter((user) => { return user.selected === true }) .map((user) => { return user['id'] }) + return [...s] }) - if (usersId().length > 1 && theme().length === 1) { - setTheme(t('Group Chat')) - } }) const handleSetTheme = () => { - setTheme(textInput.value.length > 0 && textInput.value) + setChatTitle(textInput.value.length > 0 && textInput.value) } const handleClick = (user) => { @@ -57,7 +55,7 @@ const CreateModalContent = (props: Props) => { const handleCreate = async () => { try { - const initChat = await actions.createChat(usersId(), theme()) + const initChat = await actions.createChat(usersId(), chatTitle()) console.debug('[initChat]', initChat) hideModal() await actions.loadChats()