Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in hsm template #3192

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions src/containers/HSM/HSM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@
payloadCopy.type = 'TEXT';
}

if (payloadCopy.type === 'TEXT' || isEditing) {
delete payloadCopy.attachmentURL;
}

if (tagId) {
payloadCopy.tagId = payload.tagId.id;
}
Expand All @@ -322,7 +326,6 @@
delete payloadCopy.variables;
delete payloadCopy.existingShortcode;
delete payloadCopy.newShortcode;
delete payloadCopy.attachmentURL;
return payloadCopy;
};

Expand Down Expand Up @@ -664,18 +667,22 @@
}),
templateButtons: Yup.array().of(
Yup.lazy(() => {
if (templateType === 'CALL_TO_ACTION') {
return Yup.object().shape({
type: Yup.string().required('Type is required.'),
title: Yup.string().required('Title is required.'),
value: Yup.string().required('Value is required.'),
});
} else if (templateType === 'QUICK_REPLY') {
return Yup.object().shape({
value: Yup.string().required('Value is required.'),
});
if (isAddButtonChecked) {
if (templateType === 'CALL_TO_ACTION') {
return Yup.object().shape({
type: Yup.string().required('Type is required.'),
title: Yup.string().required('Title is required.'),
value: Yup.string().required('Value is required.'),
});
} else if (templateType === 'QUICK_REPLY') {
return Yup.object().shape({
value: Yup.string().required('Value is required.'),
});
}
return Yup.object().shape({});

Check warning on line 682 in src/containers/HSM/HSM.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/HSM/HSM.tsx#L682

Added line #L682 was not covered by tests
} else {
return Yup.object().shape({});
}
return Yup.object().shape({});
})
),
};
Expand All @@ -696,7 +703,7 @@
useEffect(() => {
setSimulatorMessage(getExampleFromBody(body, variables));

if ((type === '' || type) && attachmentURL) {
if ((type === '' || type) && attachmentURL && !isEditing) {
validateURL(attachmentURL);
}
}, [type, attachmentURL]);
Expand Down
Loading