MAPC / massbuilds

Crowdsourcing authoritative info on recent & ongoing developments in Massachusetts.
https://www.massbuilds.com/
2 stars 2 forks source link

Edit submissions are being rejected #266

Open ericyoungberg opened 5 years ago

ericyoungberg commented 5 years ago

If you grep the production log for 400 Bad Request, you will find that there are many errors regarding edit submissions. I haven't confirmed if this is only occurring for unverified users who are creating new developments, but that is the initial case where this issue was brought to our attention.

When the issue occurs, we receive a JSONAPI blob from the front-end, but we never fire a database query for inserting the edit into the database. This leads me to believe that we are having an issue inside of Rails where the edit is being rejected and shooting off a 400 error.

mzagaja commented 4 years ago

It is the case that the user is not getting feedback when the edit is rejected.

This is because Rails is not getting existing form data for validation. The validation then fails, without informing the user.

Steps to recreate:

  1. Create user or login
  2. Create new development
  3. Complete form, and required fields
  4. Click "Save and Close"
  5. Click create Development again.
  6. Form will contain previously entered data.
  7. At this point, you have to change something to activate the Submit for Review button.
  8. Click Submit for Review
  9. Open developer console, see network tab, see Rails validation errors in the response.