Fix transparent checkbox for assembly on edit#16201
Conversation
📝 WalkthroughWalkthroughRemoved code that forcibly unchecked the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb`:
- Around line 139-153: The test for the transparent assembly navigates to the
wrong page and redundantly revisits assemblies_path; after clicking the assembly
title (assembly3) you must open the admin sidebar link to the edit form by
calling within_admin_sidebar_menu { click_on "About this assembly" } before
asserting have_checked_field("assembly_is_transparent"), and remove the inner
before block that re-visits decidim_admin_assemblies.assemblies_path (the outer
shared_examples before already visits the page).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
decidim-assemblies/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.jsdecidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb
💤 Files with no reviewable changes (1)
- decidim-assemblies/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb (1)
135-149: Redundantbeforeblock still causes the assemblies path to be visited three times.The inner
beforeat lines 138–140 re-visitsdecidim_admin_assemblies.assemblies_path, but the outershared_examples "updating an assembly"beforeat lines 110–112 already does so. When this example runs inside the"when managing parent assemblies"context, the fullbeforechain visits the path three times (context → shared_examples → inner describe). The previous review also proposed removing the sidebar navigation step, which the author addressed by removing it globally; only the redundantbeforeremoval remains.♻️ Proposed fix
describe "when the assembly is transparent" do let!(:assembly3) { create(:assembly, :private, :transparent, organization:) } - before do - visit decidim_admin_assemblies.assemblies_path - end - it "shows the transparent checkbox correctly" do within "tr", text: translated(assembly3.title) do click_on translated(assembly3.title) end expect(page).to have_checked_field("assembly_is_transparent") end end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb` around lines 135 - 149, The inner before block that calls visit decidim_admin_assemblies.assemblies_path is redundant because the outer shared_examples "updating an assembly" and the context already visit that path; remove the inner before (the one wrapping visit decidim_admin_assemblies.assemblies_path inside the "when the assembly is transparent" describe) so the example using let!(:assembly3) still visits the page only once via the shared_examples setup and then assert have_checked_field("assembly_is_transparent") within the row for translated(assembly3.title).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb`:
- Around line 135-149: The inner before block that calls visit
decidim_admin_assemblies.assemblies_path is redundant because the outer
shared_examples "updating an assembly" and the context already visit that path;
remove the inner before (the one wrapping visit
decidim_admin_assemblies.assemblies_path inside the "when the assembly is
transparent" describe) so the example using let!(:assembly3) still visits the
page only once via the shared_examples setup and then assert
have_checked_field("assembly_is_transparent") within the row for
translated(assembly3.title).
There was a problem hiding this comment.
♻️ Duplicate comments (1)
decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb (1)
138-144: Navigate to the edit form before asserting the checkbox.After clicking the assembly title, the UI typically lands on the components page, not the edit form that contains
assembly_is_transparent. Add the sidebar navigation step so the assertion targets the correct page.🐛 Proposed fix
it "shows the transparent checkbox correctly" do within "tr", text: translated(assembly3.title) do click_on translated(assembly3.title) end + + within_admin_sidebar_menu do + click_on "About this assembly" + end expect(page).to have_checked_field("assembly_is_transparent") end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb` around lines 138 - 144, After clicking the assembly title (the click_on translated(assembly3.title) in the spec), add a step to navigate to the assembly edit form via the sidebar before asserting the checkbox; e.g., within the sidebar (or navigation region) click the edit link so the test is on the edit page that contains the assembly_is_transparent field, then assert expect(page).to have_checked_field("assembly_is_transparent").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb`:
- Around line 138-144: After clicking the assembly title (the click_on
translated(assembly3.title) in the spec), add a step to navigate to the assembly
edit form via the sidebar before asserting the checkbox; e.g., within the
sidebar (or navigation region) click the edit link so the test is on the edit
page that contains the assembly_is_transparent field, then assert
expect(page).to have_checked_field("assembly_is_transparent").
Done all the changes already
|
Ready for the review @alecslupu |
|
Adding |
🎩 What? Why?
When saving a private and transparent assembly, the checkbox isn't shown correctly on the edit form.
This PR fixes it.
📌 Related Issues
Testing
📷 Screenshots
Before
After
Summary by CodeRabbit
Bug Fixes
Tests