feat: different validation for posts

This commit is contained in:
Nevo David 2025-07-01 17:16:56 +07:00
parent 0ed729196f
commit 530c14356a
3 changed files with 4 additions and 9 deletions

View File

@ -388,7 +388,6 @@ export const Editor: FC<{
const [id] = useState(makeId(10));
const newRef = useRef<any>(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<{
</div>
</div>
<div className="relative">
{validateChars && props.value.length < 6 && (
{validateChars && props.value.length === 0 && pictures?.length === 0 && (
<div className="px-3 text-sm bg-red-600 !text-white mb-[4px]">
{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.
</div>
)}
<div {...getRootProps()}>

View File

@ -144,7 +144,7 @@ export const ManageModal: FC<AddEditModalProps> = (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<AddEditModalProps> = (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);

View File

@ -38,7 +38,6 @@ export class Integration {
export class PostContent {
@IsDefined()
@IsString()
@MinLength(6)
content: string;
@IsOptional()