Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question should more than one word #54

Closed
mazipan opened this issue Oct 12, 2023 · 3 comments · Fixed by #67
Closed

Question should more than one word #54

mazipan opened this issue Oct 12, 2023 · 3 comments · Fixed by #67
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest

Comments

@mazipan
Copy link
Owner

mazipan commented Oct 12, 2023

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

@mazipan mazipan added bug Something isn't working good first issue Good for newcomers hacktoberfest labels Oct 12, 2023
@mazipan mazipan assigned mazipan and unassigned mazipan Oct 12, 2023
@kliu57
Copy link
Contributor

kliu57 commented Oct 13, 2023

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
Copy link
Owner Author

mazipan commented Oct 13, 2023

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
Copy link
Contributor

kliu57 commented Oct 13, 2023

Sure, will do! thanks

@kodiakhq kodiakhq bot closed this as completed in #67 Oct 13, 2023
kodiakhq bot added a commit that referenced this issue Oct 13, 2023
Closes #54 

## Description

- Added validation using Valibot to ensure that a space character is included in the question
- Ran pnpm run format then pnpm run lint --fix to auto format the code
- Tested the validation from local
- Resolved merge conflict

## Testing

- [ Test new validation on local - test one word question produces correct error message ] (test 1)
![image](https://github.com/mazipan/tanyaaja/assets/98062538/6aeba565-b5d1-4a3b-a354-1773c5e06a56)
- [ Test new validation on local - test two word question goes through and appears in DB ] (test 2)
![test2-1](https://github.com/mazipan/tanyaaja/assets/98062538/159fd179-0fee-47c8-a98e-90e1f2518699)
![test2-2](https://github.com/mazipan/tanyaaja/assets/98062538/48170796-6882-4b6d-9f35-9c28f5cfb043)
- [ Test existing validation on local - test blank question produces error ] (test 3)
![test3](https://github.com/mazipan/tanyaaja/assets/98062538/deb6f02e-d8ea-42c0-9942-d9169d415d19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants