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: decidim private fields #307

Draft
wants to merge 29 commits into
base: develop
Choose a base branch
from

Conversation

froger
Copy link

@froger froger commented May 14, 2024

Include a new feature in the Awesome module: Add private fields to custom proposals.

As a participation designer, I can define private fields for proposals to ask proposers for personal information. This personal information could be required to submit a proposal and should not involve an extra step in the proposal submission process.

Context
The city of Lausanne wanted to request private fields for their Participatory Budgeting (PB) in order to:

  • Get consent for contacting proposers.
  • Obtain a phone number.
  • Collect additional information on the project (e.g., postal addresses to send materials).

Open Source Politics also contributes, financing adaptations for export and compatibility with version 0.27. <3

Solution

In the custom field administration, add another "custom field" zone, reserved for private fields.
In the form, add a section at the end for private fields.
Add an exporter, not exposed to open-data, to export personal data from the administration.
Change exporters of proposals to include custom fields.

Screenshots
Proposal form, user side
screencapture-theme-dev-voca-city-processes-nisi-non-f-14-proposals-45-edit-draft-2024-05-14-11_25_27

Confirm screen, without private data
Screenshot 2024-05-14 at 11 26 27

Published proposal, without private data
Screenshot 2024-05-14 at 11 26 39

Visualization of the fields, admin side
Screenshot 2024-05-14 at 11 34 47

Export options for private data
Screenshot 2024-05-14 at 11 31 22

Proposal administration
screencapture-theme-dev-voca-city-admin-decidim-awesome-config-proposal-custom-fields-2024-05-14-10_15_08

@froger
Copy link
Author

froger commented May 14, 2024

So from the pipelines, I see I need to do at least:

  • Fix tests to have pipelines passing
  • Fix linting

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

Hi, thanks for this. It is interesting but I think we should change some things.
The most important is that we already have a table for extra things related to a proposal (see the comments). we should use that table.

Another is that I think we should do this for the 28 series (branch develop for the moment), as this is going to be to much work to maintain in both parts.

Then, shouldn't we use a different menu for this private fields? i think a low percentage of customization are going to use private fields and rendering duplicated FormRenders in every box might slow down the browser quite a lot.

For overrides, we are using deface, this way we can touch smaller parts of views and it makes easier to maintain.

And finally, another thought that comes to mind is that we should use the encrypt built in in some attributes in Decidim (like authorizations). Precisely because it uses private data.

@@ -0,0 +1,12 @@
# frozen_string_literal: true

class CreatePrivateProposalFields < ActiveRecord::Migration[5.2]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this migration should use the table decidim_awesome_proposal_extra_fields. it's seems unnecessary to add an additional table when we already have one for extras in proposals.

class CreatePrivateProposalFields < ActiveRecord::Migration[5.2]
def change
create_table :decidim_awesome_private_proposal_fields do |t|
t.text :private_body, default: '<xml></xml>'
Copy link
Contributor

Choose a reason for hiding this comment

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

the current body uses a jsonb field. Should we assume that this body would never be translated?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we should encrypt this field if it's going to keep private data

@froger froger marked this pull request as draft June 6, 2024 09:54
@froger froger changed the base branch from main to develop June 6, 2024 09:54
@froger
Copy link
Author

froger commented Jun 6, 2024

Putting this PR in draft the time I make the necessary updates.

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.

None yet

3 participants