Add create authorization to initiative types#9309
Add create authorization to initiative types#9309ahukkanen merged 27 commits intodecidim:developfrom
Conversation
fix test
…//github.com/eliegaboriau/decidim into add_create_authorization_to_initiative_types
ahukkanen
left a comment
There was a problem hiding this comment.
Looks great, thanks @eliegaboriau !
I just have one question, see below. I understand that you may have a valid reason to do this but just for me to understand us well, could you please explain?
decidim-initiatives/app/helpers/decidim/initiatives/initiative_helper.rb
Show resolved
Hide resolved
...im-initiatives/app/controllers/decidim/initiatives/authorization_create_modals_controller.rb
Show resolved
Hide resolved
It's actually not that great, we've seen that it's depend a lot on the "do not require authorization" configuration. |
|
@eliegaboriau Also a kind reminder to you that we are planning releasing 0.27 RC1 next week so if you'd like to incorporate this into the next release, we would need to get this done shortly. If you cannot finish it shortly, no worries! It will then be part of the 0.28 release. |
Hello @ahukkanen |
Fix not authorized modal when choosing initiative type
|
@ahukkanen It's okay for me, let me know if something's missing ! |
|
@eliegaboriau There is one conflict, could you please resolve? |
There was a problem hiding this comment.
I noticed one issue after the latest changes, could you please move the reveal to its own partial?
Also, there are some conflicts, could you resolve those?
After #9347, we also changed the default password to decidim123456789, so we also need to apply this change to the specs where you are logging in.
...-initiatives/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb
Outdated
Show resolved
Hide resolved
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
|
It should be okay now ! |
ahukkanen
left a comment
There was a problem hiding this comment.
Tested this and this works great!
The UX flow just feels weird when doing the following:
- Require authorization for initiative type creation (e.g. use the example authorization with the default configuration)
- Login with an unauthorized user account
- Go to create an initiative of the type that requires the authorization that you configured
- Authorize the user with the required authorization but provide authorization data that does not match the configurations of the configured authorization (e.g. use a different postal code than the required one)
After authorizing the account, I now see this:

If this happened, I would rather see some error message that my authorization data does not match the requirements.
But I also understand it is not in the scope of this PR, so we probably cannot do much about it. This is just how the authorizations work as they are decoupled from the sections that may or may not require an authorization.
When I click the "Verify your account to promote this initiative", I correctly see this popup as expected:

Therefore, I still get the information why I cannot vote but just the UX is pretty weird after the authorization action.
Regarding this particular PR, it's all good.
Even though this PR touches the participant facing UI, I will merge this as this has been already implemented way before the redesign guidelines were published and there were just some code cleanup happening at the final stage of the review. Also, the initiatives redesign has not started yet so I believe it won't do any harm merging this now.
Also FYI @eliegaboriau, for any further PRs, the guidelines are available at #9512 (if you didn't already know).
* first version * fix i18n * linter * linter * fix permissions fix test * fix tests add button when initiative type doesn't need an authorisation but initiative does * lint * lint * change requests * refactor * linter * Improve spec Fix not authorized modal when choosing initiative type * linter * linter * add refresh when needed * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * refactor modal in partial * linter Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
* first version * fix i18n * linter * linter * fix permissions fix test * fix tests add button when initiative type doesn't need an authorisation but initiative does * lint * lint * change requests * refactor * linter * Improve spec Fix not authorized modal when choosing initiative type * linter * linter * add refresh when needed * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * refactor modal in partial * linter Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
* first version * fix i18n * linter * linter * fix permissions fix test * fix tests add button when initiative type doesn't need an authorisation but initiative does * lint * lint * change requests * refactor * linter * Improve spec Fix not authorized modal when choosing initiative type * linter * linter * add refresh when needed * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Update decidim-initiatives/spec/system/create_initiative_spec.rb Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * refactor modal in partial * linter Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
🎩 What? Why?
This PR offers the possibility to add an authorization handler on the creation of initiatives, according to the initiative type.
It asks for the authorization when choosing the initiative type, if an authorization handler has been chosen.
If there's only one initiative type, it asks for the authorization when clicking on "new initiative"
📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
- Go to admin initiative type list
- Click on permissions for one
- Change the create permissions
- Go to initiative
- Click on create initiative
- See that under the initiative type you changed, it's written "verify your account to promote this initiative"
- Click on it
- See that it asks for an authorization
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing
The screenshots are in the issue