Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: handle error message for special characters in Identifier of Project (#9059)

Durgesh Shekhawat4280c4d1b131
diff --git a/apps/web/ce/components/projects/create/root.tsx b/apps/web/ce/components/projects/create/root.tsx
index 3e4b5b4166..442c10f7f2 100644
--- a/apps/web/ce/components/projects/create/root.tsx
+++ b/apps/web/ce/components/projects/create/root.tsx
@@ -110,7 +110,7 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
if (setToFavorite) {
handleAddToFavorites(res.id);
}
- handleNextStep(res.id);
+ return handleNextStep(res.id);
})
.catch((err) => {
try {
@@ -119,8 +119,9 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST");
const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST");
+ const nameSpecialCharError = errorData?.name?.includes("PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS");
- if (nameError || identifierError) {
+ if (nameError || identifierError || nameSpecialCharError) {
if (nameError) {
setToast({
type: TOAST_TYPE.ERROR,
@@ -136,6 +137,14 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
message: t("project_identifier_already_taken"),
});
}
+
+ if (nameSpecialCharError) {
+ setToast({
+ type: TOAST_TYPE.ERROR,
+ title: t("toast.error"),
+ message: t("project_name_cannot_contain_special_characters"),
+ });
+ }
} else {
setToast({
type: TOAST_TYPE.ERROR,
diff --git a/apps/web/core/components/project/form.tsx b/apps/web/core/components/project/form.tsx
index 2d7575436f..cfd7ea6e4e 100644
--- a/apps/web/core/components/project/form.tsx
+++ b/apps/web/core/components/project/form.tsx
@@ -105,8 +105,9 @@ export function ProjectDetailsForm(props: IProjectDetailsForm) {
const nameError = errorData.name?.includes("PROJECT_NAME_ALREADY_EXIST");
const identifierError = errorData?.identifier?.includes("PROJECT_IDENTIFIER_ALREADY_EXIST");
+ const nameSpecialCharError = errorData?.name?.includes("PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS");
- if (nameError || identifierError) {
+ if (nameError || identifierError || nameSpecialCharError) {
if (nameError) {
setToast({
type: TOAST_TYPE.ERROR,
@@ -122,6 +123,14 @@ export function ProjectDetailsForm(props: IProjectDetailsForm) {
message: t("project_identifier_already_taken"),
});
}
+
+ if (nameSpecialCharError) {
+ setToast({
+ type: TOAST_TYPE.ERROR,
+ title: t("toast.error"),
+ message: t("project_name_cannot_contain_special_characters"),
+ });
+ }
} else {
setToast({
type: TOAST_TYPE.ERROR,