Skip to content

Fix transparent checkbox for assembly on edit#16201

Merged
alecslupu merged 4 commits intodevelopfrom
fix/assembly-edit-transparent
Feb 25, 2026
Merged

Fix transparent checkbox for assembly on edit#16201
alecslupu merged 4 commits intodevelopfrom
fix/assembly-edit-transparent

Conversation

@andreslucena
Copy link
Copy Markdown
Member

@andreslucena andreslucena commented Feb 24, 2026

🎩 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

  1. Sign in as admin
  2. Edit an assembly and make it private and transparent
  3. Edit this same assembly
  4. (Before) see that the checkbox for "is transparent' isn't checked
  5. (After) see that the checkbox for "is transparent' is checked

📷 Screenshots

Before

image

After

image

♥️ Thank you!

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where the transparency checkbox was being automatically unchecked when toggling related visibility/private options; assemblies now retain their transparent setting even when the control is disabled.
  • Tests

    • Added/updated system tests to verify transparency behavior across view and edit flows, confirming the transparency checkbox displays and preserves the correct state during updates.

@andreslucena andreslucena added the type: fix PRs that implement a fix for a bug label Feb 24, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Removed code that forcibly unchecked the is_transparent checkbox when disabling/hiding fields in the assembly admin controller; the checkbox is now only disabled (not mutated). Added/updated system tests to assert the assembly_is_transparent checkbox appears checked for transparent assemblies in create and update admin flows.

Changes

Cohort / File(s) Summary
UI State Fix
decidim-assemblies/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js
Removed logic that automatically cleared the is_transparent checkbox when toggling disabled/hidden fields; the control now only receives the disabled property and no longer mutates its checked state.
Test Coverage
decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb
Renamed a test description, removed sidebar navigation steps from the update flow, and added/duplicated scenarios verifying the assembly_is_transparent checkbox is shown checked for transparent assemblies in create and update flows.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • alecslupu

Poem

🐰 I nudged a box and let it stay,
No sudden unchecks to scare the day.
Tests hop in fields to guard what's true,
Transparent tabs keep their view. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the transparent checkbox state on assembly edit forms to display correctly as checked when applicable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/assembly-edit-transparent

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions[bot]
github-actions bot previously approved these changes Feb 24, 2026
coderabbitai[bot]
coderabbitai bot previously requested changes Feb 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3b9ef1c and a83f90f.

📒 Files selected for processing (2)
  • decidim-assemblies/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js
  • decidim-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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb (1)

135-149: Redundant before block still causes the assemblies path to be visited three times.

The inner before at lines 138–140 re-visits decidim_admin_assemblies.assemblies_path, but the outer shared_examples "updating an assembly" before at lines 110–112 already does so. When this example runs inside the "when managing parent assemblies" context, the full before chain 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 redundant before removal 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).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a83f90f and 1b08ed1.

📒 Files selected for processing (1)
  • decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb

github-actions[bot]
github-actions bot previously approved these changes Feb 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ 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").

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b08ed1 and b8b5764.

📒 Files selected for processing (1)
  • decidim-assemblies/spec/system/admin/admin_manages_assemblies_spec.rb

@andreslucena
Copy link
Copy Markdown
Member Author

Ready for the review @alecslupu

@alecslupu alecslupu added the release: v0.31 Issues or PRs that need to be tackled for v0.31 label Feb 25, 2026
Copy link
Copy Markdown
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 - Merging with qlty failing pipeline

@alecslupu alecslupu merged commit ff41a04 into develop Feb 25, 2026
45 of 46 checks passed
@alecslupu alecslupu deleted the fix/assembly-edit-transparent branch February 25, 2026 10:05
@alecslupu alecslupu added the no-backport Pull Requests that should not be backported label Feb 25, 2026
@alecslupu
Copy link
Copy Markdown
Contributor

Adding no-backport as the fix happens in a Stimulus controller which became available in 0.31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: assemblies no-backport Pull Requests that should not be backported release: v0.31 Issues or PRs that need to be tackled for v0.31 type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants