Skip to content

Commit

Permalink
fix to check dynamicmedia checkbox only in case of dynamic media
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund committed Jun 12, 2024
1 parent 226dce9 commit d5e1b9c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/containers/InteractiveMessage/InteractiveMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -254,7 +260,10 @@ export const InteractiveMessage = () => {
}

if (isEditing && data.attachmentURL) {
setDynamicMedia(!isUrlValid);
const testForValidUrl = new RegExp(VALID_URL_REGEX, 'gi');

Check warning on line 263 in src/containers/InteractiveMessage/InteractiveMessage.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/InteractiveMessage/InteractiveMessage.tsx#L263

Added line #L263 was not covered by tests
if (!testForValidUrl.test(data.attachmentURL)) {
setDynamicMedia(true);

Check warning on line 265 in src/containers/InteractiveMessage/InteractiveMessage.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/InteractiveMessage/InteractiveMessage.tsx#L265

Added line #L265 was not covered by tests
}
}

if (translationsVal) {
Expand Down

0 comments on commit d5e1b9c

Please sign in to comment.