add check if empty reply

This commit is contained in:
Swrup 2022-04-04 12:45:20 +02:00
parent 21758dfae2
commit 7ad84cc1ab

View file

@ -397,6 +397,8 @@ let build_reply ~comment ~image_info ~tag_list ?parent_id user_id =
else if List.length tag_list > 30 then Error "too much tags" else if List.length tag_list > 30 then Error "too much tags"
else if List.exists (fun tag -> String.length tag > 100) tag_list then else if List.exists (fun tag -> String.length tag > 100) tag_list then
Error "tag too long" Error "tag too long"
else if Option.is_none image_info && String.length (String.trim comment) = 0
then Error "Your post must contain an image or a comment"
else else
let tag_list = let tag_list =
List.map String.lowercase_ascii List.map String.lowercase_ascii