From ebf46e001de722da46bf8aab9fb9558d2145af02 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Tue, 26 Dec 2023 21:00:37 +0530 Subject: [PATCH 01/13] Added limit exceed error message with new limit --- src/CONST.ts | 5 ++++- src/pages/EditRequestDescriptionPage.js | 17 ++++++++++++++++ src/pages/ReportWelcomeMessagePage.js | 20 +++++++++++++++++++ src/pages/iou/MoneyRequestDescriptionPage.js | 20 +++++++++++++++++++ .../request/step/IOURequestStepDescription.js | 20 +++++++++++++++++++ src/pages/tasks/NewTaskDescriptionPage.js | 19 ++++++++++++++++++ src/pages/tasks/NewTaskDetailsPage.js | 7 +++++++ src/pages/tasks/NewTaskTitlePage.js | 2 ++ src/pages/tasks/TaskDescriptionPage.js | 16 ++++++++++++++- src/pages/tasks/TaskTitlePage.js | 3 +++ src/pages/workspace/WorkspaceNewRoomPage.js | 2 ++ src/pages/workspace/WorkspaceSettingsPage.js | 6 +++--- 12 files changed, 132 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index edfea995ed9b..bc3cfee9cb3b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1488,7 +1488,10 @@ const CONST = { FORM_CHARACTER_LIMIT: 50, LEGAL_NAMES_CHARACTER_LIMIT: 150, LOGIN_CHARACTER_LIMIT: 254, - WORKSPACE_NAME_CHARACTER_LIMIT: 80, + + TITLE_CHARACTER_LIMIT: 100, + SUPPORTING_CHARACTER_LIMIT: 500, + AVATAR_CROP_MODAL: { // The next two constants control what is min and max value of the image crop scale. // Values define in how many times the image can be bigger than its container. diff --git a/src/pages/EditRequestDescriptionPage.js b/src/pages/EditRequestDescriptionPage.js index 9b2a9e465746..39d1399aad9d 100644 --- a/src/pages/EditRequestDescriptionPage.js +++ b/src/pages/EditRequestDescriptionPage.js @@ -10,6 +10,7 @@ import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; +import * as ErrorUtils from '@libs/ErrorUtils'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -28,6 +29,21 @@ function EditRequestDescriptionPage({defaultDescription, onSubmit}) { const descriptionInputRef = useRef(null); const focusTimeoutRef = useRef(null); + /** + * @param {Object} values + * @param {String} values.title + * @returns {Object} - An object containing the errors for each inputID + */ + const validate = useCallback((values) => { + const errors = {}; + + if (values.comment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'comment', ['common.error.characterLimitExceedCounter', {length: values.comment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}]); + } + + return errors; + }, []); + useFocusEffect( useCallback(() => { focusTimeoutRef.current = setTimeout(() => { @@ -55,6 +71,7 @@ function EditRequestDescriptionPage({defaultDescription, onSubmit}) { style={[styles.flexGrow1, styles.ph5]} formID={ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM} onSubmit={onSubmit} + validate={validate} submitButtonText={translate('common.save')} enabledWhenOffline > diff --git a/src/pages/ReportWelcomeMessagePage.js b/src/pages/ReportWelcomeMessagePage.js index ae8a4635a98e..218c8523e2b0 100644 --- a/src/pages/ReportWelcomeMessagePage.js +++ b/src/pages/ReportWelcomeMessagePage.js @@ -14,6 +14,7 @@ import TextInput from '@components/TextInput'; import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; @@ -56,6 +57,24 @@ function ReportWelcomeMessagePage(props) { setWelcomeMessage(value); }, []); + /** + * @param {Object} values + * @param {String} values.title + * @returns {Object} - An object containing the errors for each inputID + */ + const validate = useCallback((values) => { + const errors = {}; + + if (values.welcomeMessage.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'welcomeMessage', [ + 'common.error.characterLimitExceedCounter', + {length: values.welcomeMessage.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + ]); + } + + return errors; + }, []); + const submitForm = useCallback(() => { Report.updateWelcomeMessage(props.report.reportID, props.report.welcomeMessage, welcomeMessage.trim()); }, [props.report.reportID, props.report.welcomeMessage, welcomeMessage]); @@ -91,6 +110,7 @@ function ReportWelcomeMessagePage(props) { style={[styles.flexGrow1, styles.ph5]} formID={ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM} onSubmit={submitForm} + validate={validate} submitButtonText={props.translate('common.save')} enabledWhenOffline > diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index fe3100b8c3bd..643a068efb45 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -14,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as IOU from '@libs/actions/IOU'; import * as Browser from '@libs/Browser'; +import * as ErrorUtils from '@libs/ErrorUtils'; import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; import Navigation from '@libs/Navigation/Navigation'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; @@ -95,6 +96,24 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); } + /** + * @param {Object} values + * @param {String} values.title + * @returns {Object} - An object containing the errors for each inputID + */ + const validate = useCallback((values) => { + const errors = {}; + + if (values.moneyRequestComment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'moneyRequestComment', [ + 'common.error.characterLimitExceedCounter', + {length: values.moneyRequestComment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + ]); + } + + return errors; + }, []); + /** * Sets the money request comment by saving it to Onyx. * @@ -121,6 +140,7 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { style={[styles.flexGrow1, styles.ph5]} formID={ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM} onSubmit={(value) => updateComment(value)} + validate={validate} submitButtonText={translate('common.save')} enabledWhenOffline > diff --git a/src/pages/iou/request/step/IOURequestStepDescription.js b/src/pages/iou/request/step/IOURequestStepDescription.js index 849f3276667e..addad5af97c9 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.js +++ b/src/pages/iou/request/step/IOURequestStepDescription.js @@ -10,6 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import * as IOU from '@userActions/IOU'; @@ -61,6 +62,24 @@ function IOURequestStepDescription({ }, []), ); + /** + * @param {Object} values + * @param {String} values.title + * @returns {Object} - An object containing the errors for each inputID + */ + const validate = useCallback((values) => { + const errors = {}; + + if (values.moneyRequestComment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'moneyRequestComment', [ + 'common.error.characterLimitExceedCounter', + {length: values.moneyRequestComment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + ]); + } + + return errors; + }, []); + const navigateBack = () => { Navigation.goBack(backTo || ROUTES.HOME); }; @@ -85,6 +104,7 @@ function IOURequestStepDescription({ style={[styles.flexGrow1, styles.ph5]} formID={ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM} onSubmit={updateComment} + validate={validate} submitButtonText={translate('common.save')} enabledWhenOffline > diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index b11e7c163755..cf9b00cc308a 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -13,6 +13,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import * as Task from '@userActions/Task'; @@ -47,6 +48,23 @@ function NewTaskDescriptionPage(props) { Navigation.goBack(ROUTES.NEW_TASK); }; + /** + * @param {Object} values - form input values passed by the Form component + * @returns {Boolean} + */ + function validate(values) { + const errors = {}; + + if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskDescription', [ + 'common.error.characterLimitExceedCounter', + {length: values.taskDescription.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + ]); + } + + return errors; + } + return ( validate(values)} onSubmit={(values) => onSubmit(values)} enabledWhenOffline > diff --git a/src/pages/tasks/NewTaskDetailsPage.js b/src/pages/tasks/NewTaskDetailsPage.js index 3dab58dfad04..f57cca7799ca 100644 --- a/src/pages/tasks/NewTaskDetailsPage.js +++ b/src/pages/tasks/NewTaskDetailsPage.js @@ -58,6 +58,13 @@ function NewTaskDetailsPage(props) { if (!values.taskTitle) { // We error if the user doesn't enter a task name ErrorUtils.addErrorMessage(errors, 'taskTitle', 'newTaskPage.pleaseEnterTaskName'); + } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); + } else if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskDescription', [ + 'common.error.characterLimitExceedCounter', + {length: values.taskDescription.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + ]); } return errors; diff --git a/src/pages/tasks/NewTaskTitlePage.js b/src/pages/tasks/NewTaskTitlePage.js index 7bf6065625c0..e6da2a06435d 100644 --- a/src/pages/tasks/NewTaskTitlePage.js +++ b/src/pages/tasks/NewTaskTitlePage.js @@ -48,6 +48,8 @@ function NewTaskTitlePage(props) { if (!values.taskTitle) { // We error if the user doesn't enter a task name ErrorUtils.addErrorMessage(errors, 'taskTitle', 'newTaskPage.pleaseEnterTaskName'); + } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 3a6999d4408a..45b7f786cb2b 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -17,6 +17,7 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; @@ -49,7 +50,20 @@ const defaultProps = { const parser = new ExpensiMark(); function TaskDescriptionPage(props) { const styles = useThemeStyles(); - const validate = useCallback(() => ({}), []); + + /** + * @param {Object} values - form input values passed by the Form component + * @returns {Boolean} + */ + const validate = useCallback((values) => { + const errors = {}; + + if (values.description.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'description', ['common.error.characterLimitExceedCounter', {length: values.description.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}]); + } + + return errors; + }, []); const submit = useCallback( (values) => { diff --git a/src/pages/tasks/TaskTitlePage.js b/src/pages/tasks/TaskTitlePage.js index 9b393a8a2374..e9856c85e0d2 100644 --- a/src/pages/tasks/TaskTitlePage.js +++ b/src/pages/tasks/TaskTitlePage.js @@ -14,6 +14,7 @@ import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalD import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; @@ -53,6 +54,8 @@ function TaskTitlePage(props) { if (_.isEmpty(values.title)) { errors.title = 'newTaskPage.pleaseEnterTaskName'; + } else if (values.title.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'title', ['common.error.characterLimitExceedCounter', {length: values.title.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; diff --git a/src/pages/workspace/WorkspaceNewRoomPage.js b/src/pages/workspace/WorkspaceNewRoomPage.js index 6f86e871e8ae..bde8f3b37f8c 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.js +++ b/src/pages/workspace/WorkspaceNewRoomPage.js @@ -183,6 +183,8 @@ function WorkspaceNewRoomPage(props) { } else if (ValidationUtils.isExistingRoomName(values.roomName, props.reports, values.policyID)) { // Certain names are reserved for default rooms and should not be used for policy rooms. ErrorUtils.addErrorMessage(errors, 'roomName', 'newRoomPage.roomAlreadyExistsError'); + } else if (values.roomName.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'roomName', ['common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } if (!values.policyID) { diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js index 9bc4b755fce9..9ec33b834521 100644 --- a/src/pages/workspace/WorkspaceSettingsPage.js +++ b/src/pages/workspace/WorkspaceSettingsPage.js @@ -18,6 +18,7 @@ import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withW import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import compose from '@libs/compose'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; @@ -81,10 +82,10 @@ function WorkspaceSettingsPage({policy, currencyList, windowWidth, route}) { if (!ValidationUtils.isRequiredFulfilled(name)) { errors.name = 'workspace.editor.nameIsRequiredError'; - } else if ([...name].length > CONST.WORKSPACE_NAME_CHARACTER_LIMIT) { + } else if ([...name].length > CONST.TITLE_CHARACTER_LIMIT) { // Uses the spread syntax to count the number of Unicode code points instead of the number of UTF-16 // code units. - errors.name = 'workspace.editor.nameIsTooLongError'; + ErrorUtils.addErrorMessage(errors, 'name', ['common.error.characterLimitExceedCounter', {length: [...name].length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; @@ -148,7 +149,6 @@ function WorkspaceSettingsPage({policy, currencyList, windowWidth, route}) { label={translate('workspace.editor.nameInputLabel')} accessibilityLabel={translate('workspace.editor.nameInputLabel')} defaultValue={policy.name} - maxLength={CONST.WORKSPACE_NAME_CHARACTER_LIMIT} containerStyles={[styles.mt4]} spellCheck={false} /> From d791082cff83e311765ee8ea1a25bfe7663e5fbc Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Tue, 26 Dec 2023 21:06:42 +0530 Subject: [PATCH 02/13] type fixes --- src/languages/en.ts | 1 - src/languages/es.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index b2c08ac80974..59f61c434ee7 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1600,7 +1600,6 @@ export default { nameInputLabel: 'Name', nameInputHelpText: 'This is the name you will see on your workspace.', nameIsRequiredError: 'You need to define a name for your workspace.', - nameIsTooLongError: `Your workspace name can be at most ${CONST.WORKSPACE_NAME_CHARACTER_LIMIT} characters long.`, currencyInputLabel: 'Default currency', currencyInputHelpText: 'All expenses on this workspace will be converted to this currency.', currencyInputDisabledText: "The default currency can't be changed because this workspace is linked to a USD bank account.", diff --git a/src/languages/es.ts b/src/languages/es.ts index dfd6dab6c388..1dbd99eea92e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1624,7 +1624,6 @@ export default { nameInputLabel: 'Nombre', nameInputHelpText: 'Este es el nombre que verás en tu espacio de trabajo.', nameIsRequiredError: 'Debes definir un nombre para tu espacio de trabajo.', - nameIsTooLongError: `El nombre de su espacio de trabajo no puede tener más de ${CONST.WORKSPACE_NAME_CHARACTER_LIMIT} caracteres.`, currencyInputLabel: 'Moneda por defecto', currencyInputHelpText: 'Todas los gastos en este espacio de trabajo serán convertidos a esta moneda.', currencyInputDisabledText: 'La moneda predeterminada no se puede cambiar porque este espacio de trabajo está vinculado a una cuenta bancaria en USD.', From 84164558cc37b74a0b762e82d4beb16f10092fb3 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 29 Dec 2023 00:18:35 +0530 Subject: [PATCH 03/13] added for remaning room --- src/pages/settings/Report/RoomNamePage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/settings/Report/RoomNamePage.js b/src/pages/settings/Report/RoomNamePage.js index 5f64faca50fc..ab600161a686 100644 --- a/src/pages/settings/Report/RoomNamePage.js +++ b/src/pages/settings/Report/RoomNamePage.js @@ -69,6 +69,8 @@ function RoomNamePage({policy, report, reports, translate}) { } else if (ValidationUtils.isExistingRoomName(values.roomName, reports, report.policyID)) { // The room name can't be set to one that already exists on the policy ErrorUtils.addErrorMessage(errors, 'roomName', 'newRoomPage.roomAlreadyExistsError'); + } else if (values.roomName.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'roomName', ['common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; From cb61222097aebd1a4719e1d177a038d392f967c5 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Tue, 9 Jan 2024 21:53:10 +0530 Subject: [PATCH 04/13] limit on legal name --- .../settings/Profile/PersonalDetails/LegalNamePage.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js index 365ea62184ab..c96bc41ec0e1 100644 --- a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js +++ b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js @@ -60,8 +60,8 @@ function LegalNamePage(props) { } else if (_.isEmpty(values.legalFirstName)) { errors.legalFirstName = 'common.error.fieldRequired'; } - if (values.legalFirstName.length > CONST.LEGAL_NAME.MAX_LENGTH) { - ErrorUtils.addErrorMessage(errors, 'legalFirstName', ['common.error.characterLimitExceedCounter', {length: values.legalFirstName.length, limit: CONST.LEGAL_NAME.MAX_LENGTH}]); + if (values.legalFirstName.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'legalFirstName', ['common.error.characterLimitExceedCounter', {length: values.legalFirstName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } if (!ValidationUtils.isValidLegalName(values.legalLastName)) { @@ -69,8 +69,8 @@ function LegalNamePage(props) { } else if (_.isEmpty(values.legalLastName)) { errors.legalLastName = 'common.error.fieldRequired'; } - if (values.legalLastName.length > CONST.LEGAL_NAME.MAX_LENGTH) { - ErrorUtils.addErrorMessage(errors, 'legalLastName', ['common.error.characterLimitExceedCounter', {length: values.legalLastName.length, limit: CONST.LEGAL_NAME.MAX_LENGTH}]); + if (values.legalLastName.length > CONST.TITLE_CHARACTER_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'legalLastName', ['common.error.characterLimitExceedCounter', {length: values.legalLastName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; @@ -106,7 +106,6 @@ function LegalNamePage(props) { aria-label={props.translate('privatePersonalDetails.legalFirstName')} role={CONST.ROLE.PRESENTATION} defaultValue={legalFirstName} - maxLength={CONST.LEGAL_NAME.MAX_LENGTH + CONST.SEARCH_MAX_LENGTH} spellCheck={false} /> @@ -119,7 +118,6 @@ function LegalNamePage(props) { aria-label={props.translate('privatePersonalDetails.legalLastName')} role={CONST.ROLE.PRESENTATION} defaultValue={legalLastName} - maxLength={CONST.LEGAL_NAME.MAX_LENGTH + CONST.SEARCH_MAX_LENGTH} spellCheck={false} /> From 36492af9f46ced30292587ce7b13802d480128a5 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Tue, 16 Jan 2024 23:15:08 +0530 Subject: [PATCH 05/13] Fix to display both error validation --- src/pages/tasks/NewTaskDetailsPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/tasks/NewTaskDetailsPage.js b/src/pages/tasks/NewTaskDetailsPage.js index f57cca7799ca..8a1357efa9ae 100644 --- a/src/pages/tasks/NewTaskDetailsPage.js +++ b/src/pages/tasks/NewTaskDetailsPage.js @@ -60,7 +60,8 @@ function NewTaskDetailsPage(props) { ErrorUtils.addErrorMessage(errors, 'taskTitle', 'newTaskPage.pleaseEnterTaskName'); } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); - } else if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + } + if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'taskDescription', [ 'common.error.characterLimitExceedCounter', {length: values.taskDescription.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, From 69a50b1f2379e331bf694bcbced96486c9e08e19 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Wed, 17 Jan 2024 00:45:52 +0530 Subject: [PATCH 06/13] Fix legal name errors --- src/pages/settings/Profile/PersonalDetails/LegalNamePage.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js index c96bc41ec0e1..61d9a5a8aa8f 100644 --- a/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js +++ b/src/pages/settings/Profile/PersonalDetails/LegalNamePage.js @@ -59,8 +59,7 @@ function LegalNamePage(props) { ErrorUtils.addErrorMessage(errors, 'legalFirstName', 'privatePersonalDetails.error.hasInvalidCharacter'); } else if (_.isEmpty(values.legalFirstName)) { errors.legalFirstName = 'common.error.fieldRequired'; - } - if (values.legalFirstName.length > CONST.TITLE_CHARACTER_LIMIT) { + } else if (values.legalFirstName.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'legalFirstName', ['common.error.characterLimitExceedCounter', {length: values.legalFirstName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } @@ -68,8 +67,7 @@ function LegalNamePage(props) { ErrorUtils.addErrorMessage(errors, 'legalLastName', 'privatePersonalDetails.error.hasInvalidCharacter'); } else if (_.isEmpty(values.legalLastName)) { errors.legalLastName = 'common.error.fieldRequired'; - } - if (values.legalLastName.length > CONST.TITLE_CHARACTER_LIMIT) { + } else if (values.legalLastName.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'legalLastName', ['common.error.characterLimitExceedCounter', {length: values.legalLastName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } From 93121c7470d259307234fa821b4e0cc68b4640ba Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 19 Jan 2024 14:07:49 +0530 Subject: [PATCH 07/13] fix typo From cd2009409c880b488a34cf932d951cf94f4c78c7 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Thu, 1 Feb 2024 23:26:27 +0530 Subject: [PATCH 08/13] Change const name to more relavent --- src/CONST.ts | 2 +- src/pages/EditRequestDescriptionPage.js | 4 ++-- src/pages/ReportWelcomeMessagePage.js | 7 ++----- src/pages/iou/MoneyRequestDescriptionPage.js | 4 ++-- src/pages/iou/request/step/IOURequestStepDescription.js | 4 ++-- src/pages/tasks/NewTaskDescriptionPage.js | 7 ++----- src/pages/tasks/NewTaskDetailsPage.js | 7 ++----- src/pages/tasks/TaskDescriptionPage.js | 4 ++-- 8 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 7f815ad4c1df..5a476fd3c5d6 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1521,7 +1521,7 @@ const CONST = { LOGIN_CHARACTER_LIMIT: 254, TITLE_CHARACTER_LIMIT: 100, - SUPPORTING_CHARACTER_LIMIT: 500, + DESCRIPTION_LIMIT: 500, AVATAR_CROP_MODAL: { // The next two constants control what is min and max value of the image crop scale. diff --git a/src/pages/EditRequestDescriptionPage.js b/src/pages/EditRequestDescriptionPage.js index 39d1399aad9d..45fe1a238934 100644 --- a/src/pages/EditRequestDescriptionPage.js +++ b/src/pages/EditRequestDescriptionPage.js @@ -37,8 +37,8 @@ function EditRequestDescriptionPage({defaultDescription, onSubmit}) { const validate = useCallback((values) => { const errors = {}; - if (values.comment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'comment', ['common.error.characterLimitExceedCounter', {length: values.comment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}]); + if (values.comment.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'comment', ['common.error.characterLimitExceedCounter', {length: values.comment.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; diff --git a/src/pages/ReportWelcomeMessagePage.js b/src/pages/ReportWelcomeMessagePage.js index 218c8523e2b0..c44886dee763 100644 --- a/src/pages/ReportWelcomeMessagePage.js +++ b/src/pages/ReportWelcomeMessagePage.js @@ -65,11 +65,8 @@ function ReportWelcomeMessagePage(props) { const validate = useCallback((values) => { const errors = {}; - if (values.welcomeMessage.length > CONST.SUPPORTING_CHARACTER_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'welcomeMessage', [ - 'common.error.characterLimitExceedCounter', - {length: values.welcomeMessage.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, - ]); + if (values.welcomeMessage.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'welcomeMessage', ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 643a068efb45..7a7f08f01c41 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -104,10 +104,10 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { const validate = useCallback((values) => { const errors = {}; - if (values.moneyRequestComment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + if (values.moneyRequestComment.length > CONST.DESCRIPTION_LIMIT) { ErrorUtils.addErrorMessage(errors, 'moneyRequestComment', [ 'common.error.characterLimitExceedCounter', - {length: values.moneyRequestComment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + {length: values.moneyRequestComment.length, limit: CONST.DESCRIPTION_LIMIT}, ]); } diff --git a/src/pages/iou/request/step/IOURequestStepDescription.js b/src/pages/iou/request/step/IOURequestStepDescription.js index addad5af97c9..76ff056e4e84 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.js +++ b/src/pages/iou/request/step/IOURequestStepDescription.js @@ -70,10 +70,10 @@ function IOURequestStepDescription({ const validate = useCallback((values) => { const errors = {}; - if (values.moneyRequestComment.length > CONST.SUPPORTING_CHARACTER_LIMIT) { + if (values.moneyRequestComment.length > CONST.DESCRIPTION_LIMIT) { ErrorUtils.addErrorMessage(errors, 'moneyRequestComment', [ 'common.error.characterLimitExceedCounter', - {length: values.moneyRequestComment.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, + {length: values.moneyRequestComment.length, limit: CONST.DESCRIPTION_LIMIT}, ]); } diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index cf9b00cc308a..2a0c867c60a8 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -55,11 +55,8 @@ function NewTaskDescriptionPage(props) { function validate(values) { const errors = {}; - if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'taskDescription', [ - 'common.error.characterLimitExceedCounter', - {length: values.taskDescription.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, - ]); + if (values.taskDescription.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskDescription', ['common.error.characterLimitExceedCounter', {length: values.taskDescription.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; diff --git a/src/pages/tasks/NewTaskDetailsPage.js b/src/pages/tasks/NewTaskDetailsPage.js index 8a1357efa9ae..e4c1d627a99f 100644 --- a/src/pages/tasks/NewTaskDetailsPage.js +++ b/src/pages/tasks/NewTaskDetailsPage.js @@ -61,11 +61,8 @@ function NewTaskDetailsPage(props) { } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) { ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } - if (values.taskDescription.length > CONST.SUPPORTING_CHARACTER_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'taskDescription', [ - 'common.error.characterLimitExceedCounter', - {length: values.taskDescription.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}, - ]); + if (values.taskDescription.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'taskDescription', ['common.error.characterLimitExceedCounter', {length: values.taskDescription.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 45b7f786cb2b..c696448671ac 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -58,8 +58,8 @@ function TaskDescriptionPage(props) { const validate = useCallback((values) => { const errors = {}; - if (values.description.length > CONST.SUPPORTING_CHARACTER_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'description', ['common.error.characterLimitExceedCounter', {length: values.description.length, limit: CONST.SUPPORTING_CHARACTER_LIMIT}]); + if (values.description.length > CONST.DESCRIPTION_LIMIT) { + ErrorUtils.addErrorMessage(errors, 'description', ['common.error.characterLimitExceedCounter', {length: values.description.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; From 894129033c77450200ea03f037c02de6558fa3d9 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 2 Feb 2024 02:17:20 +0530 Subject: [PATCH 09/13] Resolve conflict --- src/ONYXKEYS.ts | 2 +- src/pages/ReportWelcomeMessagePage.tsx | 10 ++++++---- src/types/onyx/Form.ts | 5 +++++ src/types/onyx/index.ts | 13 ++++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 2867cb3905a2..d9a5eb3f5433 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -496,7 +496,7 @@ type OnyxValues = { [ONYXKEYS.FORMS.DISPLAY_NAME_FORM_DRAFT]: OnyxTypes.DisplayNameForm; [ONYXKEYS.FORMS.ROOM_NAME_FORM]: OnyxTypes.Form; [ONYXKEYS.FORMS.ROOM_NAME_FORM_DRAFT]: OnyxTypes.Form; - [ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM]: OnyxTypes.WelcomeMessageForm; [ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM_DRAFT]: OnyxTypes.Form; [ONYXKEYS.FORMS.LEGAL_NAME_FORM]: OnyxTypes.Form; [ONYXKEYS.FORMS.LEGAL_NAME_FORM_DRAFT]: OnyxTypes.Form; diff --git a/src/pages/ReportWelcomeMessagePage.tsx b/src/pages/ReportWelcomeMessagePage.tsx index fefdbcd174d5..fe6061d9e8c8 100644 --- a/src/pages/ReportWelcomeMessagePage.tsx +++ b/src/pages/ReportWelcomeMessagePage.tsx @@ -8,6 +8,7 @@ import {withOnyx} from 'react-native-onyx'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; +import type {OnyxFormValuesFields} from '@components/Form/types'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import type {AnimatedTextInputRef} from '@components/RNTextInput'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -15,6 +16,7 @@ import Text from '@components/Text'; import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import updateMultilineInputRange from '@libs/updateMultilineInputRange'; @@ -25,6 +27,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {Policy} from '@src/types/onyx'; +import type {Errors} from '@src/types/onyx/OnyxCommon'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; @@ -51,12 +54,10 @@ function ReportWelcomeMessagePage({report, policy}: ReportWelcomeMessagePageProp }, []); /** - * @param {Object} values - * @param {String} values.title * @returns {Object} - An object containing the errors for each inputID */ - const validate = useCallback((values) => { - const errors = {}; + const validate = useCallback((values: OnyxFormValuesFields) => { + const errors: Errors = {}; if (values.welcomeMessage.length > CONST.DESCRIPTION_LIMIT) { ErrorUtils.addErrorMessage(errors, 'welcomeMessage', ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}]); @@ -99,6 +100,7 @@ function ReportWelcomeMessagePage({report, policy}: ReportWelcomeMessagePageProp ; +type WelcomeMessageForm = Form<{ + welcomeMessage: string; +}>; + type PersonalBankAccountForm = Form; type ReportFieldEditForm = Form>; @@ -73,4 +77,5 @@ export type { IntroSchoolPrincipalForm, PersonalBankAccountForm, ReportFieldEditForm, + WelcomeMessageForm, }; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 64eec736b5bf..c48270dc726a 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -9,7 +9,17 @@ import type Credentials from './Credentials'; import type Currency from './Currency'; import type CustomStatusDraft from './CustomStatusDraft'; import type Download from './Download'; -import type {AddDebitCardForm, DateOfBirthForm, DisplayNameForm, IKnowATeacherForm, IntroSchoolPrincipalForm, NewRoomForm, PrivateNotesForm, ReportFieldEditForm} from './Form'; +import type { + AddDebitCardForm, + DateOfBirthForm, + DisplayNameForm, + IKnowATeacherForm, + IntroSchoolPrincipalForm, + NewRoomForm, + PrivateNotesForm, + ReportFieldEditForm, + WelcomeMessageForm, +} from './Form'; import type Form from './Form'; import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import type {FundList} from './Fund'; @@ -152,4 +162,5 @@ export type { IntroSchoolPrincipalForm, PrivateNotesForm, ReportFieldEditForm, + WelcomeMessageForm, }; From 784d5bc8461204d28b9e658c6df44efe1deafc65 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 2 Feb 2024 02:21:02 +0530 Subject: [PATCH 10/13] Resolve conflict - 1 --- src/pages/ReportWelcomeMessagePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ReportWelcomeMessagePage.tsx b/src/pages/ReportWelcomeMessagePage.tsx index fe6061d9e8c8..27522fb6aacf 100644 --- a/src/pages/ReportWelcomeMessagePage.tsx +++ b/src/pages/ReportWelcomeMessagePage.tsx @@ -60,7 +60,7 @@ function ReportWelcomeMessagePage({report, policy}: ReportWelcomeMessagePageProp const errors: Errors = {}; if (values.welcomeMessage.length > CONST.DESCRIPTION_LIMIT) { - ErrorUtils.addErrorMessage(errors, 'welcomeMessage', ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}]); + errors.welcomeMessage = ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}].toLocaleString(); } return errors; From 02883acc135d35b91abe6d683f2b327451d40e67 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 2 Feb 2024 03:15:03 +0530 Subject: [PATCH 11/13] Resolve conflict - 3 --- src/CONST.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CONST.ts b/src/CONST.ts index 5c2d3ffd21f0..edaa146ba701 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1563,6 +1563,7 @@ const CONST = { TITLE_CHARACTER_LIMIT: 100, DESCRIPTION_LIMIT: 500, + WORKSPACE_NAME_CHARACTER_LIMIT: 80, AVATAR_CROP_MODAL: { // The next two constants control what is min and max value of the image crop scale. // Values define in how many times the image can be bigger than its container. From 00eedccb221f5453bb54a3455902dbf19e9b30d1 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Fri, 2 Feb 2024 20:52:56 +0530 Subject: [PATCH 12/13] added proper error messages --- src/libs/ErrorUtils.ts | 2 +- src/pages/ReportWelcomeMessagePage.tsx | 2 +- src/pages/workspace/WorkspaceNamePage.tsx | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/ErrorUtils.ts b/src/libs/ErrorUtils.ts index edc24bf94720..6298138a5825 100644 --- a/src/libs/ErrorUtils.ts +++ b/src/libs/ErrorUtils.ts @@ -113,7 +113,7 @@ type ErrorsList = Record; * @param errors - An object containing current errors in the form * @param message - Message to assign to the inputID errors */ -function addErrorMessage(errors: ErrorsList, inputID?: string, message?: TKey) { +function addErrorMessage(errors: ErrorsList, inputID?: string, message?: TKey | Localize.MaybePhraseKey) { if (!message || !inputID) { return; } diff --git a/src/pages/ReportWelcomeMessagePage.tsx b/src/pages/ReportWelcomeMessagePage.tsx index 27522fb6aacf..fe6061d9e8c8 100644 --- a/src/pages/ReportWelcomeMessagePage.tsx +++ b/src/pages/ReportWelcomeMessagePage.tsx @@ -60,7 +60,7 @@ function ReportWelcomeMessagePage({report, policy}: ReportWelcomeMessagePageProp const errors: Errors = {}; if (values.welcomeMessage.length > CONST.DESCRIPTION_LIMIT) { - errors.welcomeMessage = ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}].toLocaleString(); + ErrorUtils.addErrorMessage(errors, 'welcomeMessage', ['common.error.characterLimitExceedCounter', {length: values.welcomeMessage.length, limit: CONST.DESCRIPTION_LIMIT}]); } return errors; diff --git a/src/pages/workspace/WorkspaceNamePage.tsx b/src/pages/workspace/WorkspaceNamePage.tsx index e9d1ddd021d0..59679456be56 100644 --- a/src/pages/workspace/WorkspaceNamePage.tsx +++ b/src/pages/workspace/WorkspaceNamePage.tsx @@ -8,6 +8,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as ValidationUtils from '@libs/ValidationUtils'; import * as Policy from '@userActions/Policy'; @@ -41,10 +42,10 @@ function WorkspaceNamePage({policy}: Props) { if (!ValidationUtils.isRequiredFulfilled(name)) { errors.name = 'workspace.editor.nameIsRequiredError'; - } else if ([...name].length > CONST.WORKSPACE_NAME_CHARACTER_LIMIT) { + } else if ([...name].length > CONST.TITLE_CHARACTER_LIMIT) { // Uses the spread syntax to count the number of Unicode code points instead of the number of UTF-16 // code units. - errors.name = 'workspace.editor.nameIsTooLongError'; + ErrorUtils.addErrorMessage(errors, 'name', ['common.error.characterLimitExceedCounter', {length: [...name].length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } return errors; From 36d9542d19fccff89bfe49ec1372691350480620 Mon Sep 17 00:00:00 2001 From: dhairyasenjaliya Date: Tue, 6 Feb 2024 14:29:17 +0530 Subject: [PATCH 13/13] Remove key for welcome message --- src/types/onyx/Form.ts | 5 ----- src/types/onyx/index.ts | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts index c03e6aee4200..6938e17163d2 100644 --- a/src/types/onyx/Form.ts +++ b/src/types/onyx/Form.ts @@ -55,10 +55,6 @@ type PrivateNotesForm = Form<{ privateNotes: string; }>; -type WelcomeMessageForm = Form<{ - welcomeMessage: string; -}>; - type PersonalBankAccountForm = Form; type WorkspaceSettingsForm = Form<{ @@ -91,7 +87,6 @@ export type { PersonalBankAccountForm, WorkspaceSettingsForm, ReportFieldEditForm, - WelcomeMessageForm, CloseAccountForm, RoomNameForm, }; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index f02c583b5955..4728c8872e75 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -20,7 +20,6 @@ import type { PrivateNotesForm, ReportFieldEditForm, RoomNameForm, - WelcomeMessageForm, WorkspaceSettingsForm, } from './Form'; import type Form from './Form'; @@ -169,6 +168,5 @@ export type { IntroSchoolPrincipalForm, PrivateNotesForm, ReportFieldEditForm, - WelcomeMessageForm, RoomNameForm, };