Skip to content

Refactor modules mounting routes#13294

Merged
andreslucena merged 10 commits intodecidim:developfrom
i-need-another-coffee:chore/patch-routes
Jan 10, 2025
Merged

Refactor modules mounting routes#13294
andreslucena merged 10 commits intodecidim:developfrom
i-need-another-coffee:chore/patch-routes

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Aug 19, 2024

🎩 What? Why?

While working on #13267, i have noticed that some of the specs have started to fail due to some wrong routes being generated. Among those routes, are the admin templates, and admin participatory space. Upon a closer investigation, i have seen that the routes are being correctly generated in console, but for some reason they are not being correctly generated in the web interface.

The edit admin participatory space route was generated without the /admin namespace when called from the user interface, yet it was correctly generated when was called from admin interface.

Investigating rails routing data, i came across: rails/rails#51933 and rails/rails#45719 which may be the culprits of this issue.

Trying the fix suggested in rails/rails#51933 with an override, i got even more specs that were failing.
When i have looked at the changes suggested by rails/rails#45719, I could not find the config setting that would have allowed me to properly set the data at engine level.

In order to be able to keep the functionality, i had attempted to define some helper methods to redefine the decidim_admin_assemblies engine to be specially used for that button, yet it still failed. As an attempt to fix the issue, i have tried also the changes in this PR, and worked flawlessly.

I am opening a standalone PR, as this change could be elaborated more. While this PR changes only the admin routes :

Decidim.participatory_space_manifests.each do |manifest|
mount manifest.context(:admin).engine, at: "/", as: "decidim_admin_#{manifest.name}"
end

and also

mount Decidim::Templates::AdminEngine, at: "/templates", as: "decidim_admin_templates" if Decidim.module_installed?(:templates)

An open question regarding the consistency still remains for verification engines mounted in admin, namely :

Decidim.authorization_admin_engines.each do |manifest|
mount manifest.admin_engine, at: "/#{manifest.name}", as: "decidim_admin_#{manifest.name}"
end

And, also, for consistency reasons I would perform the same kind of changes for the frontend part.

📌 Related Issues

Link your PR to an issue

Testing

  1. All the test suite should be green
  2. Booting any application using this patch should still work as before.

♥️ Thank you!

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']

@alecslupu alecslupu added the type: change PRs that implement a change for an existing feature label Aug 19, 2024
github-actions[bot]
github-actions bot previously approved these changes Aug 19, 2024
@alecslupu alecslupu added this to the 0.30.0 milestone Aug 19, 2024
@alecslupu alecslupu mentioned this pull request Aug 19, 2024
@probot-autolabeler probot-autolabeler bot added configuration dependencies Pull requests that update a dependency file or issues that talk about updating dependencies javascript Pull requests that update Javascript code module: accountability labels Sep 9, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 9, 2024
@alecslupu alecslupu dismissed github-actions[bot]’s stale review September 9, 2024 21:06

The merge-base changed after approval.

github-actions[bot]
github-actions bot previously approved these changes Sep 9, 2024
@andreslucena
Copy link
Copy Markdown
Member

As we discussed in the meeting, I don't have any alternative way of doing this.

I agree with what you mention about consistency, the routes should be all the similar that we can between the different kind of modules (being for participants or admins).

Apart from what you mentioned and added in the PR, I'd also add some Releases Notes in 5. Changes in APIs, so developers can know why and how do this change in their modules.

github-actions[bot]
github-actions bot previously approved these changes Sep 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 29, 2024
@alecslupu alecslupu marked this pull request as ready for review September 29, 2024 18:36
github-actions[bot]
github-actions bot previously approved these changes Jan 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Jan 7, 2025
@alecslupu alecslupu requested a review from andreslucena January 7, 2025 11:37
@andreslucena andreslucena changed the title Refactor decidim mounting routes option Refactor modules mounting routes option Jan 8, 2025
@andreslucena andreslucena changed the title Refactor modules mounting routes option Refactor modules mounting routes Jan 8, 2025
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
github-actions[bot]
github-actions bot previously approved these changes Jan 8, 2025
@alecslupu alecslupu requested a review from andreslucena January 8, 2025 10:10
github-actions[bot]
github-actions bot previously approved these changes Jan 8, 2025
@andreslucena
Copy link
Copy Markdown
Member

@alecslupu can you solve the git conflicts here 🙏🏽 ?

@alecslupu
Copy link
Copy Markdown
Contributor Author

@alecslupu can you solve the git conflicts here 🙏🏽 ?

Done

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 know this PR wasn't easy, but congratulations! Everything seems to work like a charm.

wedding-crasher-hro

@andreslucena andreslucena merged commit 6e68f40 into decidim:develop Jan 10, 2025
entantoencuanto added a commit that referenced this pull request Jan 14, 2025
* develop: (27 commits)
  WCAG navigation submenu (#13796)
  Update gem dependencies (part 3) (#13849)
  Prevent notifications for deleted users (#13812)
  Retries NPM installation a couple times to prevent network timeouts (#13831)
  Update gem dependencies (part 2) (#13839)
  Enhance signature pdf export (#13778)
  Fix HexaPDF dependency (#13834)
  Fix flaky spec in authentication (#13827)
  Merge upload field for documents and image on proposal admin form (#13735)
  Update gem dependencies (#13835)
  Upgrade erb_lint to 0.8.0 (#13833)
  Fix flaky spec in geocoder (#13820)
  Refactor modules mounting routes (#13294)
  Upgrade check-spelling action (#13825)
  Add missing images in the custom registration emails from meetings (#13632)
  Add missing translations (#13793)
  Fix proposal map performance with hundreds of markers (#13798)
  Create multiple surveys within same Survey component (#13420)
  Accountability bulk actions (#13730)
  Improve UI for sorting options on comments (#13670)
  ...
antopalidi pushed a commit to openpoke/decidim that referenced this pull request Feb 12, 2025
* Refactor decidim mounting routes option

* Fix failing specs

* Apply review recommendation

* Run lint on release notes

* Apply suggestions from code review

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

* Run linters

---------

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
andreslucena added a commit that referenced this pull request Mar 3, 2025
* Refactor decidim mounting routes option

* Fix failing specs

* Apply review recommendation

* Run lint on release notes

* Apply suggestions from code review

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

* Run linters

---------

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

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants