mazipan / tanyaaja.in

❓Kumpulkan pertanyaan secara anonim dari siapa saja dengan mudah
https://tanyaaja.in
MIT License
134 stars 36 forks source link

Question should more than one word #54

Closed mazipan closed 11 months ago

mazipan commented 11 months ago

Describe the bug Some people just testing the TanyaAja by submitting "one word" question such as "test", "testing", etc. This kind of action should not allowed from the first place.

To Reproduce Steps to reproduce the behavior:

  1. Go to public question form submission, e.g: https://www.tanyaaja.in/p/mzp
  2. Type one word question
  3. Submit question
  4. Question submitted

Expected behavior Question should not submitted, and show error message that we are not allowing this kind of action due to it's not seems as a honest question

Additional context Add new validation rule using Valibot to check "one word" question, if possible

kliu57 commented 11 months ago

Hi, could you assign this issue to me? I have installed the program and successfully ran it on my local, and I have verified the bug. I have not used Valibot before, but I will look into it. Could you also provide the error message you wish to display and where it should be displayed?

mazipan commented 11 months ago

Seems you can use https://valibot.dev/api/includes/, it should include a space char.

Pipes with current validation https://github.com/mazipan/tanyaaja/blob/master/src/modules/PublicQuestionPage/QuestionForm.tsx#L31-L33

Error message: Pertanyaan membutuhkan lebih dari satu kata

Just create a Draft Pull Request first to assign your self

kliu57 commented 11 months ago

Sure, will do! thanks