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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception in Initiatives' Page #10928

Merged
merged 11 commits into from
Jun 6, 2023
Merged

Fix exception in Initiatives' Page #10928

merged 11 commits into from
Jun 6, 2023

Conversation

andreslucena
Copy link
Member

馃帺 What? Why?

There's a bug on the creation of Initiatives related to the Page functionality

Steps to reproduce
  1. Create a new initiative (or use one initiative from the seeded database)
  2. Go to the public page (aka show.html.erb)
  3. Click on "Page"
  4. See exception
Explanation

This is related to the introduction of Decidim::Env with #8725: we're passing a string for the Decidim::initiatives.default_components, where we used to have a symbol.

default_components: <%%= Decidim::Env.new("INITIATIVES_DEFAULT_COMPONENTS", "pages, meetings").to_array.to_json %>

Mind that some installations didn't make the change to using the configuration with EnvVars, that's why its working there (for instance in https://try.decidim.org)

This PR fixes this bug in three different ways:

  1. For existing installations, there's a new rake task: bin/rails decidim:initiatives:upgrade:fix_broken_pages
  2. For new initiatives, we fix it on the command
  3. For seeds (development and staging), we fix it on the seed

馃搶 Related Issues

Testing

Rake task
  1. Check the bug by following the instructions on "Steps to reproduce"
  2. Run bin/rails decidim:initiatives:upgrade:fix_broken_pages
  3. Check that the page is working

Note that it seems like the design is broken, but that's actually unrelated to the fix. It's because we have the redesign implemented on develop in decidim-pages

New initiatives
  1. Sign in as a user
  2. Go to Initiatives, create a new Initiative
  3. Go to the initiative public page (aka show)
  4. Click on "Page"
  5. See that it works
Seeded initiatives

Regenerate the database and check that it is working by going to the "Page" of an Initiative

bin/rails db:drop db:setup db:seed

馃摲 Screenshots

Screenshot with the broken link

鈾ワ笍 Thank you!

@andreslucena andreslucena added module: initiatives type: fix PRs that implement a fix for a bug labels May 30, 2023
@andreslucena andreslucena changed the title Add spec for checking that the Page inside of an Initiative works Fix exception in Initiatives' Page May 30, 2023
Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

@andreslucena can you have a look, on why this command is not being load up?

RELEASE_NOTES.md Outdated Show resolved Hide resolved
RELEASE_NOTES.md Outdated Show resolved Hide resolved
andreslucena and others added 2 commits June 6, 2023 07:45
Suggested on code review

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
Suggested on code review

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@alecslupu alecslupu merged commit a50fa4d into develop Jun 6, 2023
45 of 46 checks passed
@alecslupu alecslupu deleted the fix/initiatives-pages branch June 6, 2023 07:30
@alecslupu alecslupu added this to Pending review from Product in Maintainers via automation Jun 13, 2023
@alecslupu alecslupu moved this from Pending review from Product to Backport pending in Maintainers Jun 13, 2023
@alecslupu alecslupu moved this from Backport pending to Done in Maintainers Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: initiatives type: fix PRs that implement a fix for a bug
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants