A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
chore: set max characters for title&display_name
haitao(lj)8668f09ae1b0
diff --git a/ui/src/components/Editor/ToolBars/image.tsx b/ui/src/components/Editor/ToolBars/image.tsxindex b8b79ce9..fdde738d 100644--- a/ui/src/components/Editor/ToolBars/image.tsx+++ b/ui/src/components/Editor/ToolBars/image.tsx@@ -232,10 +232,12 @@ const Image: FC<IEditorContext> = ({ editor }) => {</Modal.Header><Modal.Body><Tabs onSelect={handleSelect}>- <Tab eventKey="localImage" title={t('image.tab_1')}>+ <Tab eventKey="localImage" title={t('image.tab_image')}><Form className="mt-3" onSubmit={handleClick}><Form.Group controlId="editor.imgLink" className="mb-3">- <Form.Label>{t('image.form1.fields.file.label')}</Form.Label>+ <Form.Label>+ {t('image.form_image.fields.file.label')}+ </Form.Label><Form.Controltype="file"onChange={onUpload}@@ -243,13 +245,13 @@ const Image: FC<IEditorContext> = ({ editor }) => {/><Form.Control.Feedback type="invalid">- {t('image.form1.fields.file.msg.empty')}+ {t('image.form_image.fields.file.msg.empty')}</Form.Control.Feedback></Form.Group><Form.Group controlId="editor.imgDescription" className="mb-3"><Form.Label>- {t('image.form1.fields.description.label')}+ {t('image.form_image.fields.description.label')}</Form.Label><Form.Controltype="text"@@ -262,10 +264,12 @@ const Image: FC<IEditorContext> = ({ editor }) => {</Form.Group></Form></Tab>- <Tab eventKey="remoteImage" title={t('image.tab_2')}>+ <Tab eventKey="remoteImage" title={t('image.tab_url')}><Form className="mt-3" onSubmit={handleClick}><Form.Group controlId="editor.imgUrl" className="mb-3">- <Form.Label>{t('image.form2.fields.url.label')}</Form.Label>+ <Form.Label>+ {t('image.form_url.fields.url.label')}+ </Form.Label><Form.Controltype="text"value={link.value}@@ -275,12 +279,14 @@ const Image: FC<IEditorContext> = ({ editor }) => {isInvalid={currentTab === 'remoteImage' && link.isInvalid}/><Form.Control.Feedback type="invalid">- {t('image.form2.fields.url.msg.empty')}+ {t('image.form_url.fields.url.msg.empty')}</Form.Control.Feedback></Form.Group><Form.Group controlId="editor.imgName" className="mb-3">- <Form.Label>{t('image.form2.fields.name.label')}</Form.Label>+ <Form.Label>+ {t('image.form_url.fields.name.label')}+ </Form.Label><Form.Controltype="text"value={imageName.value}diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.jsonindex cb6fb595..f5c5136f 100644--- a/ui/src/i18n/locales/en.json+++ b/ui/src/i18n/locales/en.json@@ -100,8 +100,8 @@"image": {"text": "Image","add_image": "Add image",- "tab_1": "Upload image",- "form1": {+ "tab_image": "Upload image",+ "form_image": {"fields": {"file": {"label": "Image file",@@ -117,8 +117,8 @@}}},- "tab_2": "Image URL",- "form2": {+ "tab_url": "Image URL",+ "form_url": {"fields": {"url": {"label": "Image URL",@@ -361,7 +361,8 @@"label": "Title","placeholder": "Be specific and imagine you’re asking a question to another person","msg": {- "empty": "Title cannot be empty."+ "empty": "Title cannot be empty.",+ "range": "Title up to 150 characters"}},"body": {@@ -454,7 +455,8 @@"name": {"label": "Name","msg": {- "empty": "Name cannot be empty."+ "empty": "Name cannot be empty.",+ "range": "Name up to 30 characters"}},"email": {@@ -512,7 +514,8 @@"btn_name": "Update profile","display_name": {"label": "Display name",- "msg": "Display name cannot be empty."+ "msg": "Display name cannot be empty.",+ "msg_range": "Display name up to 30 characters"},"avatar": {"label": "Profile image",@@ -864,4 +867,4 @@}}}-}\ No newline at end of file+}diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsxindex 23d4c72f..40826251 100644--- a/ui/src/pages/Questions/Ask/index.tsx+++ b/ui/src/pages/Questions/Ask/index.tsx@@ -124,6 +124,13 @@ const Ask = () => {isInvalid: true,errorMsg: t('form.fields.title.msg.empty'),};+ } else if ([...title.value].length > 150) {+ bol = false;+ formData.title = {+ value: title.value,+ isInvalid: true,+ errorMsg: t('form.fields.title.msg.range'),+ };} else {formData.title = {value: title.value,diff --git a/ui/src/pages/Users/Register/components/SignUpForm/index.tsx b/ui/src/pages/Users/Register/components/SignUpForm/index.tsxindex 072093b9..4f2174d2 100644--- a/ui/src/pages/Users/Register/components/SignUpForm/index.tsx+++ b/ui/src/pages/Users/Register/components/SignUpForm/index.tsx@@ -52,6 +52,13 @@ const Index: React.FC<Props> = ({ callback }) => {isInvalid: true,errorMsg: t('name.msg.empty'),};+ } else if ([...name.value].length > 30) {+ bol = false;+ formData.name = {+ value: name.value,+ isInvalid: true,+ errorMsg: t('name.msg.range'),+ };}if (!e_mail.value) {@@ -182,7 +189,7 @@ const Index: React.FC<Props> = ({ callback }) => {<div className="text-center"><Trans i18nKey="login.info_login" ns="translation">- DAlready have an account? <Link to="/users/login">Log in</Link>+ Already have an account? <Link to="/users/login">Log in</Link></Trans></div></Col>diff --git a/ui/src/pages/Users/Settings/Profile/index.tsx b/ui/src/pages/Users/Settings/Profile/index.tsxindex 24c1b12a..87e800ee 100644--- a/ui/src/pages/Users/Settings/Profile/index.tsx+++ b/ui/src/pages/Users/Settings/Profile/index.tsx@@ -74,6 +74,13 @@ const Index: React.FC = () => {isInvalid: true,errorMsg: t('display_name.msg'),};+ } else if ([...display_name.value].length > 30) {+ bol = false;+ formData.display_name = {+ value: display_name.value,+ isInvalid: true,+ errorMsg: t('display_name.msg_range'),+ };}const reg = /^(http|https):\/\//g;diff --git a/ui/tsconfig.json b/ui/tsconfig.jsonindex f3a13afb..c3804747 100644--- a/ui/tsconfig.json+++ b/ui/tsconfig.json@@ -7,6 +7,7 @@"esModuleInterop": true,"allowSyntheticDefaultImports": true,"strict": true,+ "downlevelIteration": true,"forceConsistentCasingInFileNames": true,"noFallthroughCasesInSwitch": true,"module": "esnext",