fix: Incorrect Error Toast for Ending Card (#3306)

This commit is contained in:
Vardhaman Bhandari
2024-10-07 04:05:34 +05:30
committed by GitHub
parent 3a49abda43
commit e8403699e1

View File

@@ -122,7 +122,8 @@ export const validateCardFieldsForAllLanguages = (
// even if one of the keys is an empty string, its okay but it shouldn't be undefined
const cardTypeLabel =
cardType === "welcome" ? "Welcome card" : `Redirect to Url ${((endingCardIndex ?? -1) + 1).toString()}`;
cardType === "welcome" ? "Welcome card" : `Ending card ${((endingCardIndex ?? -1) + 1).toString()}`; // Ensure 1-based indexing
const path = cardType === "welcome" ? ["welcomeCard", field] : ["endings", endingCardIndex ?? -1, field];
for (const language of languages) {
@@ -148,7 +149,7 @@ export const validateCardFieldsForAllLanguages = (
const message = isDefaultOnly
? `${messagePrefix}${messageField} on the ${cardTypeLabel}${messageSuffix}`
: `${messagePrefix}${messageField} on the ${cardTypeLabel}${messageSuffix} -fLang- ${invalidLanguageCodes.join()}`;
: `${messagePrefix}${messageField} on the ${cardTypeLabel}${messageSuffix} -fLang- ${invalidLanguageCodes.join(", ")}`;
if (invalidLanguageCodes.length) {
return {