-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: listings management draft and publish validation backend & frontend #1850
Conversation
✔️ Deploy Preview for dev-bloom ready! 🔨 Explore the source changes: 45c3aa3 🔍 Inspect the deploy log: https://app.netlify.com/sites/dev-bloom/deploys/6158d072d540b70008e5cf3f 😎 Browse the preview: https://deploy-preview-1850--dev-bloom.netlify.app |
✔️ Deploy Preview for dev-storybook-bloom ready! 🔨 Explore the source changes: 45c3aa3 🔍 Inspect the deploy log: https://app.netlify.com/sites/dev-storybook-bloom/deploys/6158d072ead1500008dedc6d 😎 Browse the preview: https://deploy-preview-1850--dev-storybook-bloom.netlify.app |
✔️ Deploy Preview for dev-partners-bloom ready! 🔨 Explore the source changes: 45c3aa3 🔍 Inspect the deploy log: https://app.netlify.com/sites/dev-partners-bloom/deploys/6158d072da94050007060a2f 😎 Browse the preview: https://deploy-preview-1850--dev-partners-bloom.netlify.app |
dcb229a
to
4a241f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. I think the error message should be different than generic:
#1542
"Please resolve any errors before publishing your listing."
2. Noticed a problem when I trigger errors and then fill the form with correct values:
See video: https://share.getcloudapp.com/NQuYXn1R
So the correct jurisdiction value has been removed and I still see an error.
3. When I put a user agent phone, then the phone should be validated using phone regex
Currently, I am able to put a phone with the incorrect format: https://share.getcloudapp.com/o0uP01R0
4. "Is the waitlist open?" field is not validated
https://share.getcloudapp.com/d5uR5QgB
5. Lottery fields
When I choose the lottery option, I suppose date fields also should be required (?)
https://share.getcloudapp.com/nOuvO476
6. Add unit
When I tried to add a new unit type (I've just selected unit type "studio" from the select field, other fields were empty), I've noticed the error: https://share.getcloudapp.com/wbubgOgw
7. Edit and delete unit don't work
Nothing happened after click
https://share.getcloudapp.com/E0ujvN1B
8. Building address validation
https://share.getcloudapp.com/NQuYXn84
When I filled only street address, other errors have gone:
https://share.getcloudapp.com/9ZuQp65e
9. Application types validation doesn't work:
https://share.getcloudapp.com/bLuqL21x
Everything is fixed except for 6 which is waiting on a product update / followup ticket :)
Ty again for this ✨ amazing ✨ review! :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I still have a problem with the phone number, it's validated, but then I trigger an error (e.g. phone field is empty) - then fill it correctly, I'm still facing the error:
https://share.getcloudapp.com/v1u07GWO -
When I'm trying to save as a draft, I see building address errors (I think they shouldn't be required in the draft state):
https://share.getcloudapp.com/L1urAldZ -
When I'm editing a listing and triggering publish action (with some issues, empty fields), then listing unit actions (edit, delete) don't work.
Otherwise looks good to me, it's a large amount of great work, @emilyjablonski ! 💪
@dominikx96 Thank you again 🙏
|
Okay the unit issue is fixed! And as far as the phone number issue, the number 444-444-4444 fails (and it does too in the validator's official demo so it is supposed to http://libphonenumber.appspot.com/phonenumberparser?number=4444444444&country=US) and I believe this is because it is validating that the phone number is a valid US phone number down the area code, and 444 isn't a valid US area code. If I put in for example my phone number, it works. I assume we want to restrict to US phone numbers? |
@emilyjablonski you're right, I tried with the US number and it works better than I expected! :D I noticed one thing, building address probably should be optional for draft, but I still see errors: |
@dominikx96 I can't repro that, will slack you |
As we discussed at the meeting, it was my fault, I forgot to fetch changes, LGTM! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emilyjablonski ,
Took an initial pass and added some comments. Going to finish review in the morning.
? /https?:\/\//.exec(listingFormPhoto.fileId) | ||
? listingFormPhoto.fileId | ||
: cloudinaryUrlFromId(listingFormPhoto.fileId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was already here, but regex.test might be better used here instead of exec.
sites/partners/src/listings/PaperListingForm/sections/BuildingDetails.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @emilyjablonski! I think my main comment would be that if src/listings/PaperListingForm/index.tsx
is getting changed to this degree, it'd be a great opportunity to refactor. The file's getting pretty large (~800 lines) and feels like it needs more of an architecture. What do you think?
@jaredcwhite I think that's an excellent idea that given the already large size and complexity of this PR should be handled in a separate issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @emilyjablonski . I created a new issue off of @jaredcwhite's comment on refactoring the main listing form.
Pull Request Template
Issue
Addresses #1543 #1541 #1811 #1542
Description
Adds the backend and frontend pieces for validations on listings management on both draft and publish. I also refactored a little how we are submitting data so we don't need to keep track of status or submitData in state.
For draft, required fields are:
For publish, required fields are:
Type of change
How Can This Be Tested/Reviewed?
Create a new listing from scratch and without filling anything out and try to save as draft and publish and the frontend validations should kick in. Also try to edit an existing listing.
The one kinda wonky frontend validation is buildingAddress, because if you send nothing we get a generic "buildingAddress" error but if at least one field is filled out we get errors specific to the four required fields. Should show as individual errors tho.
Checklist:
yarn generate:client
if I made backend changes