Skip to content

Fix rollback questionnaire answer when file is invalid#9361

Merged
ahukkanen merged 2 commits intodecidim:developfrom
CodiTramuntana:fix/rollback_answer_when_file_is_invalid
Jun 14, 2022
Merged

Fix rollback questionnaire answer when file is invalid#9361
ahukkanen merged 2 commits intodecidim:developfrom
CodiTramuntana:fix/rollback_answer_when_file_is_invalid

Conversation

@laurajaime
Copy link
Copy Markdown
Contributor

@laurajaime laurajaime commented May 25, 2022

🎩 What? Why?

In questionnaires, if there is a question to upload a file and it has an invalid content type, the answer is also saved, but the file has not been saved as it is invalid.

Changes:

  • Indicate the content type correctly if it is an UploadedFile, this was failing.
  • Added add_documents error if the attachment has an error and could not be created.
  • The transaction now rollback if the attachment is invalid.
  • The answer_questionnaire has been checked to be correct, otherwise the answer and what comes after it should not be saved.

Testing

  1. Go to any questionnaire
  2. Try to upload any file invalid (per example: a presentation (.odp))
  3. Check that you can't send answers and you must see errors in form.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Captura de pantalla de 2022-05-25 12-25-26

♥️ Thank you!

@laurajaime laurajaime changed the title Fix transaction in answer questionnaire and validations for attachments Fix rollback questionnaire answer when file is invalid May 25, 2022
@laurajaime laurajaime marked this pull request as ready for review May 26, 2022 09:07
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

Great job @LauraJaimeC !

I have only one question on code simplification

Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

LGTM

@ahukkanen ahukkanen merged commit 441a461 into decidim:develop Jun 14, 2022
@tramuntanal tramuntanal deleted the fix/rollback_answer_when_file_is_invalid branch June 17, 2022 07:53
andreslucena pushed a commit that referenced this pull request Jul 6, 2022
* Fix transaction in answer questionnaire and validations for attachments

* Add test and fix lint
andreslucena pushed a commit that referenced this pull request Jul 6, 2022
* Fix transaction in answer questionnaire and validations for attachments

* Add test and fix lint
ahukkanen pushed a commit that referenced this pull request Jul 8, 2022
* Fix transaction in answer questionnaire and validations for attachments

* Add test and fix lint

Co-authored-by: LauraJaimeC <75725233+LauraJaimeC@users.noreply.github.com>
andreslucena added a commit that referenced this pull request Jul 13, 2022
* Fix transaction in answer questionnaire and validations for attachments

* Add test and fix lint

Co-authored-by: LauraJaimeC <75725233+LauraJaimeC@users.noreply.github.com>
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* Fix transaction in answer questionnaire and validations for attachments

* Add test and fix lint
@alecslupu alecslupu added this to the 0.27.0 milestone Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants