Skip to content

Commit 530c143

Browse files
committed
feat: different validation for posts
1 parent 0ed7291 commit 530c143

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

apps/frontend/src/components/new-launch/editor.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ export const Editor: FC<{
388388
const [id] = useState(makeId(10));
389389
const newRef = useRef<any>(null);
390390
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
391-
const [isUploading, setIsUploading] = useState(false);
392391
const t = useT();
393392

394393
const uppy = useUppyUploader({
@@ -476,12 +475,9 @@ export const Editor: FC<{
476475
</div>
477476
</div>
478477
<div className="relative">
479-
{validateChars && props.value.length < 6 && (
478+
{validateChars && props.value.length === 0 && pictures?.length === 0 && (
480479
<div className="px-3 text-sm bg-red-600 !text-white mb-[4px]">
481-
{t(
482-
'the_post_should_be_at_least_6_characters_long',
483-
'The post should be at least 6 characters long'
484-
)}
480+
Your post should have at least one character or one image.
485481
</div>
486482
)}
487483
<div {...getRootProps()}>

apps/frontend/src/components/new-launch/manage.modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const ManageModal: FC<AddEditModalProps> = (props) => {
144144
const notEnoughChars = checkAllValid.filter((p: any) => {
145145
return p.values.some((a: any) => {
146146
return (
147-
countCharacters(a.content, p?.integration?.identifier || '') < 6
147+
countCharacters(a.content, p?.integration?.identifier || '') === 0 && a.media?.length === 0
148148
);
149149
});
150150
});
@@ -153,7 +153,7 @@ export const ManageModal: FC<AddEditModalProps> = (props) => {
153153
toaster.show(
154154
'' +
155155
item.integration.name +
156-
' post is too short, it must be at least 6 characters',
156+
' Your post should have at least one character or one image.',
157157
'warning'
158158
);
159159
setLoading(false);

libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export class Integration {
3838
export class PostContent {
3939
@IsDefined()
4040
@IsString()
41-
@MinLength(6)
4241
content: string;
4342

4443
@IsOptional()

0 commit comments

Comments
 (0)