From 226dce9d945f88b80a183e712caae32dbe8d9abf Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Wed, 12 Jun 2024 15:36:05 +0530 Subject: [PATCH 1/2] fixed the validation of url --- src/containers/InteractiveMessage/InteractiveMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/InteractiveMessage/InteractiveMessage.tsx b/src/containers/InteractiveMessage/InteractiveMessage.tsx index 295af963c..6234d7607 100644 --- a/src/containers/InteractiveMessage/InteractiveMessage.tsx +++ b/src/containers/InteractiveMessage/InteractiveMessage.tsx @@ -286,7 +286,7 @@ export const InteractiveMessage = () => { if (!dynamicMedia && (type === '' || type) && attachmentURL) { validateURL(attachmentURL); } - }, [type, attachmentURL]); + }, [type, attachmentURL, dynamicMedia]); const handleAddInteractiveTemplate = ( addFromTemplate: boolean, From d5e1b9ced06a4c8cd37af76a584cf58b109915cc Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Thu, 13 Jun 2024 00:04:23 +0100 Subject: [PATCH 2/2] fix to check dynamicmedia checkbox only in case of dynamic media --- .../InteractiveMessage/InteractiveMessage.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/containers/InteractiveMessage/InteractiveMessage.tsx b/src/containers/InteractiveMessage/InteractiveMessage.tsx index 6234d7607..81b66c183 100644 --- a/src/containers/InteractiveMessage/InteractiveMessage.tsx +++ b/src/containers/InteractiveMessage/InteractiveMessage.tsx @@ -20,7 +20,13 @@ import { EmojiInput } from 'components/UI/Form/EmojiInput/EmojiInput'; import { AutoComplete } from 'components/UI/Form/AutoComplete/AutoComplete'; import { Simulator } from 'components/simulator/Simulator'; import { LanguageBar } from 'components/UI/LanguageBar/LanguageBar'; -import { LIST, LOCATION_REQUEST, MEDIA_MESSAGE_TYPES, QUICK_REPLY } from 'common/constants'; +import { + LIST, + LOCATION_REQUEST, + MEDIA_MESSAGE_TYPES, + QUICK_REPLY, + VALID_URL_REGEX, +} from 'common/constants'; import { validateMedia } from 'common/utils'; import { Loading } from 'components/UI/Layout/Loading/Loading'; import { InteractiveOptions } from './InteractiveOptions/InteractiveOptions'; @@ -254,7 +260,10 @@ export const InteractiveMessage = () => { } if (isEditing && data.attachmentURL) { - setDynamicMedia(!isUrlValid); + const testForValidUrl = new RegExp(VALID_URL_REGEX, 'gi'); + if (!testForValidUrl.test(data.attachmentURL)) { + setDynamicMedia(true); + } } if (translationsVal) {