From 530c14356ae3cc7dbaeda2bb99e4a3e48f82a417 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Tue, 1 Jul 2025 17:16:56 +0700 Subject: [PATCH] feat: different validation for posts --- apps/frontend/src/components/new-launch/editor.tsx | 8 ++------ apps/frontend/src/components/new-launch/manage.modal.tsx | 4 ++-- .../nestjs-libraries/src/dtos/posts/create.post.dto.ts | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/frontend/src/components/new-launch/editor.tsx b/apps/frontend/src/components/new-launch/editor.tsx index 5a7c92a4..f3a9fd39 100644 --- a/apps/frontend/src/components/new-launch/editor.tsx +++ b/apps/frontend/src/components/new-launch/editor.tsx @@ -388,7 +388,6 @@ export const Editor: FC<{ const [id] = useState(makeId(10)); const newRef = useRef(null); const [emojiPickerOpen, setEmojiPickerOpen] = useState(false); - const [isUploading, setIsUploading] = useState(false); const t = useT(); const uppy = useUppyUploader({ @@ -476,12 +475,9 @@ export const Editor: FC<{
- {validateChars && props.value.length < 6 && ( + {validateChars && props.value.length === 0 && pictures?.length === 0 && (
- {t( - 'the_post_should_be_at_least_6_characters_long', - 'The post should be at least 6 characters long' - )} + Your post should have at least one character or one image.
)}
diff --git a/apps/frontend/src/components/new-launch/manage.modal.tsx b/apps/frontend/src/components/new-launch/manage.modal.tsx index ab308d70..e3f5d3fd 100644 --- a/apps/frontend/src/components/new-launch/manage.modal.tsx +++ b/apps/frontend/src/components/new-launch/manage.modal.tsx @@ -144,7 +144,7 @@ export const ManageModal: FC = (props) => { const notEnoughChars = checkAllValid.filter((p: any) => { return p.values.some((a: any) => { return ( - countCharacters(a.content, p?.integration?.identifier || '') < 6 + countCharacters(a.content, p?.integration?.identifier || '') === 0 && a.media?.length === 0 ); }); }); @@ -153,7 +153,7 @@ export const ManageModal: FC = (props) => { toaster.show( '' + item.integration.name + - ' post is too short, it must be at least 6 characters', + ' Your post should have at least one character or one image.', 'warning' ); setLoading(false); diff --git a/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts b/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts index 4a0cc5c7..07e23d24 100644 --- a/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts +++ b/libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts @@ -38,7 +38,6 @@ export class Integration { export class PostContent { @IsDefined() @IsString() - @MinLength(6) content: string; @IsOptional()