Skip to content

Fix can_participate? into ParticipatoryProcessStep#16008

Merged
andreslucena merged 5 commits intodevelopfrom
fix/can-participate
Feb 6, 2026
Merged

Fix can_participate? into ParticipatoryProcessStep#16008
andreslucena merged 5 commits intodevelopfrom
fix/can-participate

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Feb 5, 2026

🎩 What? Why?

While i was trying to check the issue fixed by #15950 i went to the notifications path and i got served with an error, caused by activation of a new ParticipatoryProcessStep. This Step was activated when i have locally tested #15988

Additionally i am adding a spec for the work done in #15950.

image

📌 Related Issues

Link your PR to an issue

Testing

  1. Login as admin
  2. Visit the Participatory process frontend site & make sure you follow it
  3. Visit a participatory process in admin
  4. Create a new ParticipatoryProcessStep & activate
  5. Visit the frontend site
  6. Go to your notifications
  7. See error
  8. Apply patch
  9. See error is gone

To validate the spec, switch to this branch, edit the Attachment work and revert the work done in #15950, then run: ./bin/rspec decidim-participatory_processes/spec/system/admin/admin_manages_participatory_process_attachments_spec.rb

You should see an error similar with the above.

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

Summary by CodeRabbit

  • New Features

    • Participatory process steps can directly access participation eligibility from their parent process.
  • Tests

    • Added system tests covering notifications when participatory process steps are activated.
    • Added system tests verifying notifications after attachments are added to participatory processes and assemblies.

Copilot AI review requested due to automatic review settings February 5, 2026 22:07
@alecslupu alecslupu added release: v0.30 Issues or PRs that need to be tackled for v0.30 release: v0.31 Issues or PRs that need to be tackled for v0.31 labels Feb 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Added a delegation in Decidim::ParticipatoryProcessStep to forward can_participate? to its participatory process, and expanded system specs to assert notification behavior for step activation and attachment creation.

Changes

Cohort / File(s) Summary
Model Delegation
decidim-participatory_processes/app/models/decidim/participatory_process_step.rb
Added delegate :can_participate?, to: :participatory_process to forward participation checks from step to its parent process.
Participatory Process Step Tests
decidim-participatory_processes/spec/system/participatory_process_steps_spec.rb
Added a "when activating a step" context that sets up a confirmed user and follow, activates a step, waits for enqueued jobs, and asserts a notification mentioning the phase activation.
Attachment Notification Tests
decidim-assemblies/spec/system/admin/admin_manages_assembly_attachments_spec.rb, decidim-participatory_processes/spec/system/admin/admin_manages_participatory_process_attachments_spec.rb
Wrapped existing attachment management examples with a "when checking notifications" context and added tests creating follows, submitting attachments (multilingual), and asserting notifications appear after enqueued jobs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • andreslucena
  • github-actions

Poem

🐰 I hop, I nudge, I softly say,

"Can you take part?" — I pass the way.
Notifications ring, attachments land,
Steps awaken at my command,
Code carrot cheer — a delightful day! 🥕

🚥 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: adding a delegation to forward the can_participate? method to ParticipatoryProcessStep, which directly addresses the NoMethodError documented in the PR objectives.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/can-participate

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 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a missing can_participate? method in ParticipatoryProcessStep that caused errors when viewing notifications after a step activation. The fix delegates the method to the parent participatory_process, following the established pattern used by other child models like Component and Attachment. The PR also adds comprehensive test coverage for both the step activation notification flow and the attachment notification flow (related to PR #15950).

Changes:

  • Added delegation of can_participate? from ParticipatoryProcessStep to its parent participatory_process
  • Added system test for step activation notifications to ensure the fix works correctly
  • Refactored and enhanced attachment tests to validate that attachment notifications display properly (coverage for PR #15950)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
decidim-participatory_processes/app/models/decidim/participatory_process_step.rb Adds delegate :can_participate?, to: :participatory_process to fix notification rendering errors
decidim-participatory_processes/spec/system/participatory_process_steps_spec.rb Adds test case for step activation notification display to verify the fix
decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb Refactors attachment creation test and adds new test for attachment notifications to verify PR #15950

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

github-actions[bot]
github-actions bot previously approved these changes Feb 5, 2026
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.

Only a quick change clarifying the example

@andreslucena andreslucena self-assigned this Feb 6, 2026
…ess_steps_spec.rb

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
@alecslupu
Copy link
Copy Markdown
Contributor Author

@andreslucena This is ready for another look

@andreslucena
Copy link
Copy Markdown
Member

Merging with the only failure of qlty coverage (a bug on simplecov/parallel specs/GH retries, as it says that's -15% but that doesn't make much sense)

@andreslucena andreslucena merged commit 6aeaffc into develop Feb 6, 2026
52 of 53 checks passed
@andreslucena andreslucena deleted the fix/can-participate branch February 6, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: admin module: assemblies module: participatory processes release: v0.30 Issues or PRs that need to be tackled for v0.30 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.

3 participants