Fix broken attachments with form validation errors#7336
Fix broken attachments with form validation errors#7336mrcasals merged 11 commits intodecidim:developfrom
Conversation
When submitting existing records that have attachments (photos and documents) and there are validation errors on the form, the view would break before because it assumed the submitted attachment IDs are attachment records.
|
@ahukkanen thank you so much for this PR! I just merged #7054, which should solve the same issue but only for initiatives. Do you mind taking a look at it, see if there's any incompatibility with the two solutions? Git doesn't highlight any conflict, but both solutions are different so there might be some logic problem... |
|
Thanks for the heads up @mrcasals ! I checked it and indeed, it fixes the same issue for the initiatives form. I added a revert commit for #7054 to this PR and added that in the related PRs. It wouldn't break even if it was there but #7054 is unnecessary once this is merged. There are also added tests in this PR that cover these cases to make sure. |
|
Perfect, @ahukkanen, thanks so much for taking care of this! ❤️ |
|
@ahukkanen some tests are failing! 👀 🔍 |
After changing the forms to contain Attachment records, they were not correctly handled in the commands as they added IDs to the list of documents and photos.
In order to avoid collisions when running the specs in random order, specify the controller to be tested specifically.
In order to fix Rubocop issues, move the controller specs to correctly formatted directories.
|
@mrcasals Fixed the remaining issues and some failing specs. Initiatives test set seems to pass for me locally and for consultations, the error is the same as in other PRs right now, so it is most likely unrelated to this PR. Maybe re-running would work (although the consultations test seems to fail constantly)? |
|
@ahukkanen I've restarted the tests, but I guess rebasing the PR from |
🎩 What? Why?
When there is a form that has attachments on it (photos or documents), the form will break in case you submit it and the following is true:
Currently this can happen on the proposals form for instance (see testing).
The following kind of stack trace will appear in the console from this error:
📌 Related Issues
Testing
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.