From 393cff85eafbc2ec0b2e91df3f409cbb27c974ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Malzieu?= Date: Fri, 25 Oct 2024 17:51:24 +0200 Subject: [PATCH] Fabri QA for frames & deeplinks (#1098) * Fabri QA for frames & deeplinks * also allow ' & " at beginning * comments --- .../Chat/ChatPlaceholder/GroupChatPlaceholder.tsx | 10 ++++++++-- screens/Conversation.tsx | 5 ++++- utils/regex.ts | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx b/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx index 2ad008613..69d72b052 100644 --- a/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx +++ b/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx @@ -3,6 +3,7 @@ import { useGroupName } from "@hooks/useGroupName"; import { translate } from "@i18n"; import { useGroupQuery } from "@queries/useGroupQuery"; import { textPrimaryColor } from "@styles/colors"; +import { isGroupTopic } from "@utils/groupUtils/groupId"; import { useCallback, useMemo } from "react"; import { Keyboard, @@ -25,6 +26,7 @@ type Props = { }; export function GroupChatPlaceholder({ messagesCount }: Props) { + const topic = useConversationContext("topic"); const conversation = useConversationContext("conversation"); const onReadyToFocus = useConversationContext("onReadyToFocus"); @@ -74,9 +76,13 @@ export function GroupChatPlaceholder({ messagesCount }: Props) { {!conversation && ( - + {!topic && } - {translate("opening_conversation")} + {topic + ? isGroupTopic(topic) + ? translate("group_not_found") + : translate("conversation_not_found") + : translate("opening_conversation")} )} diff --git a/screens/Conversation.tsx b/screens/Conversation.tsx index e24e4522d..7c34ac100 100644 --- a/screens/Conversation.tsx +++ b/screens/Conversation.tsx @@ -115,7 +115,8 @@ const Conversation = ({ } } else if ( route.params?.mainConversationWithPeer && - !openedMainConvo.current + !openedMainConvo.current && + !conversationTopicRef.current ) { openedMainConvo.current = true; openMainConversationWithPeer( @@ -286,6 +287,7 @@ const Conversation = ({ const conversationContextValue = useMemo( () => ({ + topic: conversationTopic, conversation, messageToPrefill, inputRef: textInputRef, @@ -300,6 +302,7 @@ const Conversation = ({ tagsFetchedOnceForMessage, }), [ + conversationTopic, conversation, messageToPrefill, textInputRef, diff --git a/utils/regex.ts b/utils/regex.ts index da9c53c1c..49d4d1458 100644 --- a/utils/regex.ts +++ b/utils/regex.ts @@ -1,6 +1,6 @@ -const BOUNDARY_START_LOOKBEHIND = /(\s|\()/.source; // Either a space or a ( +const BOUNDARY_START_LOOKBEHIND = /(\s|\(|"|')/.source; // Either a space or a (, or a " or a ' const BOUNDARY_START = new RegExp(`(?<=${BOUNDARY_START_LOOKBEHIND})|^`).source; // It must be start of the line or be preceded by lookbehind -const BOUNDARY_END_LOOKAHEAD = /(\s|\)|$|\.|!|\?|\r\n|\r|\n)/.source; // Either a space, the end of the text, or a ), a ., a !, a ?, a line break +const BOUNDARY_END_LOOKAHEAD = /(\s|\)|$|\.|!|\?|\r\n|\r|\n|"|')/.source; // Either a space, the end of the text, or a ), a ., a !, a ?, a line break, or a " or a ' const BOUNDARY_END = new RegExp(`(?=${BOUNDARY_END_LOOKAHEAD})`).source; const WORD_CONTENT = /[^()/\s]/.source; // Not a space, not a ( or ), not a /