Skip to content

Refactor intiative wizard#10727

Merged
andreslucena merged 24 commits intodevelopfrom
refactor/initiative-creation
May 31, 2023
Merged

Refactor intiative wizard#10727
andreslucena merged 24 commits intodevelopfrom
refactor/initiative-creation

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Apr 17, 2023

🎩 What? Why?

This PR improves the Create initiative wizard, by removing the session support in favor of the database support.

📌 Related Issues

Link your PR to an issue

Testing

  1. Visit the admin panel , and enable the WYSIWYG for public participants
  2. Configure the initiatives
  3. Create an initiative.
  4. See that you get an error
  5. Apply patch
  6. Create an initiative
  7. See there is no error.

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

@alecslupu alecslupu force-pushed the refactor/initiative-creation branch from 5ab6922 to c012e6d Compare April 18, 2023 15:07
@alecslupu
Copy link
Copy Markdown
Contributor Author

@decidim/maintainers , how should i label this ? Shall we consider it a fix, or a change?

@alecslupu alecslupu marked this pull request as ready for review April 26, 2023 09:16
@alecslupu alecslupu force-pushed the refactor/initiative-creation branch from 2ffeb2c to cdce5cc Compare May 6, 2023 11:16
@andreslucena
Copy link
Copy Markdown
Member

andreslucena commented May 23, 2023

how should i label this ? Shall we consider it a fix, or a change?

Let's review it first and once we all are OK with the final form let's talk about that, as it could be difficult to backport (and that's the main difference between type: change and type: fix at the moment).

Great change! This is the typical bad decision made years ago that we had to change sometime ago, so I'm glad to actually see this going forward 😄

I have some changes to request that I found doing the comparison between how it worked and how it works now:

  • Remove scope selector from Start step (/create_initiative/previous_form)
v0.27 this PR
Start step in v0.27 screenshot Start step in this PR screenshot
  • Scope selector isn't translated
    Selection_049

  • Missing type selector in Create step (/create_initiative/fill_data)

v0.27 this PR
Create step in v0.27 screenshot Create step in this PR screenshot

@alecslupu alecslupu force-pushed the refactor/initiative-creation branch 2 times, most recently from 157f090 to a180a1b Compare May 24, 2023 10:58
@alecslupu alecslupu force-pushed the refactor/initiative-creation branch from a180a1b to 13531f5 Compare May 24, 2023 11:07
@alecslupu
Copy link
Copy Markdown
Contributor Author

@andreslucena, suggestions applied. Can you have a look?

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

I've finished a first check of the code and I have some suggestions and doubts, can you check them out please?

@alecslupu alecslupu requested a review from andreslucena May 25, 2023 13:10
@alecslupu
Copy link
Copy Markdown
Contributor Author

@andreslucena this can be reviewed. There are some comments left unresolved for you to see as there i had some different approach on various things

@alecslupu alecslupu requested a review from andreslucena May 30, 2023 08:27
@andreslucena
Copy link
Copy Markdown
Member

how should i label this ? Shall we consider it a fix, or a change?

After seeing that the change is quite big, and as this apart from fixing some bugs could introduce some new bugs, I'd prefer to leave this as a type: change and not backport this.

I guess that the real issue is that I'm not confident in the current test suite regarding all the combination of InitiativeTypes options.

@alecslupu alecslupu added the type: change PRs that implement a change for an existing feature label May 30, 2023
andreslucena
andreslucena previously approved these changes May 30, 2023
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Just tried one more time locally and everything looks good 👏🏽 👏🏽
Thanks @alecslupu for handling this long-standing issue.
As it's a big change, lets wait for @ahukkanen review and approval before merging this

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

I have gone through these changes and tested the changes from the user perspective. The bug that these refactoring efforts are fixing is gone and initiative creation now works fine even with longer descriptions. 👍

Glancing through the code, I don't have much comments, only one potential bug I noticed that reminded me about an older bug. I added a small comment regarding that.

Other than that this is all good for me.

I also must say that I am not an expert with initiatives, so I would definitely trust @andreslucena review much more than mine. For me this module has always been very hard to understand as we haven't had any actual use for it in our instances, so I haven't put much effort into understanding this module myself. I can still see that the code is quite complex and overwhelming, so there must be many more places for refactoring there but this is already a great start with a nice bugfix. Great work!

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Everything is fine for me!

I'll let @andreslucena to make the final merge as he put most of the effort in reviewing this (and because the latest commit dismissed his previous review).

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

👍🏽

@andreslucena andreslucena merged commit 8169381 into develop May 31, 2023
@andreslucena andreslucena deleted the refactor/initiative-creation branch May 31, 2023 06:45
@alecslupu alecslupu mentioned this pull request Jun 12, 2023
2 tasks
fblupi pushed a commit to AjuntamentdeBarcelona/decidim that referenced this pull request Feb 23, 2024
* Refactor intiative wizard

* Fix the initiative creation

* Fixing failing specs

* Apply review recommendations

* Update decidim-initiatives/app/models/decidim/initiative.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Apply review recommendations

* Fix the user group creation

* Small refactor on initiatives

* Add spec for custom signature end date in update command

* Update decidim-initiatives/app/controllers/decidim/initiatives/create_initiative_controller.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Update decidim-initiatives/lib/decidim/initiatives/engine.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Apply latest review recommendations

* Add area spec

* Apply suggestions from code review

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

---------

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
fblupi pushed a commit to AjuntamentdeBarcelona/decidim that referenced this pull request Feb 27, 2024
* Refactor intiative wizard

* Fix the initiative creation

* Fixing failing specs

* Apply review recommendations

* Update decidim-initiatives/app/models/decidim/initiative.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Apply review recommendations

* Fix the user group creation

* Small refactor on initiatives

* Add spec for custom signature end date in update command

* Update decidim-initiatives/app/controllers/decidim/initiatives/create_initiative_controller.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Update decidim-initiatives/lib/decidim/initiatives/engine.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>

* Apply latest review recommendations

* Add area spec

* Apply suggestions from code review

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

---------

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: initiatives type: change PRs that implement a change for an existing feature

Projects

None yet

3 participants