feat: Add validation for website and remove validation for library item name (#4269)

* Github->GitHub

* allow numbers

* remove validation for lib/item name
This commit is contained in:
Aakansha Doshi 2021-11-18 15:54:26 +05:30 committed by GitHub
parent 34a382ace9
commit e4d02fb275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -120,9 +120,6 @@ const PublishLibrary = ({
if (!libItem.name) { if (!libItem.name) {
error = t("publishDialog.errors.required"); error = t("publishDialog.errors.required");
isError = true; isError = true;
} else if (!/^[a-zA-Z\s]+$/i.test(libItem.name)) {
error = t("publishDialog.errors.letter&Spaces");
isError = true;
} }
erroredLibItems.push({ ...libItem, error }); erroredLibItems.push({ ...libItem, error });
}); });
@ -381,6 +378,8 @@ const PublishLibrary = ({
<input <input
type="text" type="text"
name="website" name="website"
pattern="https?://.+"
title={t("publishDialog.errors.website")}
value={libraryData.website} value={libraryData.website}
onChange={onInputChange} onChange={onInputChange}
placeholder={t("publishDialog.placeholder.website")} placeholder={t("publishDialog.placeholder.website")}

View File

@ -290,13 +290,13 @@
"authorName": "Your name or username", "authorName": "Your name or username",
"libraryName": "Name of your library", "libraryName": "Name of your library",
"libraryDesc": "Description of your library to help people understand its usage", "libraryDesc": "Description of your library to help people understand its usage",
"githubHandle": "Github handle (optional), so you can edit the library once submitted for review", "githubHandle": "GitHub handle (optional), so you can edit the library once submitted for review",
"twitterHandle": "Twitter username (optional), so we know who to credit when promoting over Twitter", "twitterHandle": "Twitter username (optional), so we know who to credit when promoting over Twitter",
"website": "Link to your personal website or elsewhere (optional)" "website": "Link to your personal website or elsewhere (optional)"
}, },
"errors": { "errors": {
"required": "Required", "required": "Required",
"letter&Spaces": "Only letters and spaces allowed" "website": "Enter a valid Url"
}, },
"noteDescription": { "noteDescription": {
"pre": "Submit your library to be included in the ", "pre": "Submit your library to be included in the ",