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

fix: validate the proposal creation form #524

Merged
merged 23 commits into from
Aug 2, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jul 24, 2024

Summary

Closes: #517

This PR validates fields on proposal creation.

It adds:

  • maxLength validation on the title (256 chars max, limit from offchain)
  • maxItems validation on number of choices (500 choices max, limit from offchain)
  • maxLength validation on discussion (256 chars max, limit from offchain)
  • maxLength validation on body (10k for regular spaces, 40k for turbo, also coming from offchain)

Other changes:

  • The form will now always show error on load (so that error show directly when loading a draft, and don't require to dirty fields) (will be extracted to another PR)
  • max body length for regular onchain proposals has been bumped to 10k instead of 9600 chars (see fix: show error on Editor composer textarea #520 (comment)). Will revert this if there's some technical constraints preventing that, else will keep this for consistency

How to test

  1. Go to the proposal creation page for a turbo space
  2. Put some long text in the body textarea
  3. It should show an error when the content exceed 40k chars
  4. Got to a proposal creation page for a regular space (offchain and onchain), e.g: http://localhost:8080/#/s:pistachiodao.eth/create
  5. Put some long text in the body textarea
  6. It should show an error when the content exceed 10k chars
  7. Same for the title and discussion fields, it should show an error when content exceed 256 chars

TODO

  • Waiting for fix: always show voting type selection in Editor #512 merging, as it contains pretty big changes on how Editor and useEditor behave (particularly make it async, by pulling space data). This will avoid duplicate changes on this PR, which also need to pull space data to detected turbo spaces

@wa0x6e wa0x6e marked this pull request as draft July 24, 2024 04:20
@wa0x6e wa0x6e changed the title Fix-validate-proposals-fields fix: validate the proposal creation form Jul 24, 2024
Base automatically changed from fix-limit-proposal-fields-length to master July 31, 2024 10:03
@wa0x6e wa0x6e marked this pull request as ready for review August 1, 2024 04:47
@wa0x6e wa0x6e requested review from Sekhmet and bonustrack August 1, 2024 04:47
apps/ui/src/views/Editor.vue Outdated Show resolved Hide resolved
apps/ui/src/components/Ui/InputString.vue Outdated Show resolved Hide resolved
@wa0x6e wa0x6e requested a review from Sekhmet August 2, 2024 03:12
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@Sekhmet Sekhmet merged commit ad1cf8e into master Aug 2, 2024
3 checks passed
@Sekhmet Sekhmet deleted the fix-validate-proposals-fields branch August 2, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: missing title and body max length on proposal
2 participants