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

Feat/add decrypted private body to extra fields #105

Merged

Conversation

Stef-Rousset
Copy link
Contributor

@Stef-Rousset Stef-Rousset commented Oct 10, 2024

🎩 Description

Add new column on ProposalExtraField to store decrypted private body date, and add rake task to update existing data.

📌 Related Issues

Testing

You may need to test this in docker if you can't add private fields in local

  1. As an admin, go to Decidim Awesome
  2. Go to private_fields of Proposals custom fields and add a custom field, for example a radio group applicable on processes proposals (see screenshot)
  3. Go to a process, than to proposals and add a new proposal
  4. In rails console, check that a proposal extra field has been created with Decidim::DecidimAwesome::ProposalExtraField.last, and that it contains a decrypted_private_body that looks like "<xml><dl class=\"decidim_awesome-custom_fields\" data-generator=\"decidim_awesome\ (........) </dl></xml>"

To test the rake task:

  1. Go to rails console and set the decrypted_private_body of proposal extra field previously created to nil with Decidim::DecidimAwesome::ProposalExtraField.last.update_columns(decrypted_private_body: nil) (if in docker, run docker compose exec app rails console)
  2. Run the rake task with bundle exec rake decidim:set_decrypted_private_body (or in docker docker compose run app rake decidim:set_decrypted_private_body)
  3. Check in the console that the previous proposal extra field has a decrypted_private_body again

Tasks

  • [X ] Add specs

📷 Screenshots

Please add screenshots of the changes you're proposing if related to the UI
img

@Stef-Rousset Stef-Rousset marked this pull request as ready for review October 10, 2024 07:51
@luciegrau luciegrau requested a review from moustachu October 10, 2024 08:00
@Stef-Rousset Stef-Rousset removed the request for review from moustachu October 14, 2024 07:43
Copy link
Contributor

@BarbaraOliveira13 BarbaraOliveira13 left a comment

Choose a reason for hiding this comment

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

Looks good 👍 I also ran it and that works 🎉

@BarbaraOliveira13 BarbaraOliveira13 self-requested a review October 14, 2024 13:46
Copy link
Contributor

@BarbaraOliveira13 BarbaraOliveira13 left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Copy link
Contributor

@Quentinchampenois Quentinchampenois left a comment

Choose a reason for hiding this comment

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

Looks good to me !

For next iterations, we should move the rake task to a dedicated Job and update extra_fields with batches in case of heavy database

@Quentinchampenois Quentinchampenois merged commit 9d55622 into develop Oct 14, 2024
14 checks passed
@Quentinchampenois Quentinchampenois deleted the feat/add_decrypted_private_body_to_extra_fields branch October 14, 2024 15:51
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.

3 participants