Skip to content

Fix notification from Component publication#15830

Merged
alecslupu merged 1 commit intodevelopfrom
fix/component-notification
Dec 20, 2025
Merged

Fix notification from Component publication#15830
alecslupu merged 1 commit intodevelopfrom
fix/component-notification

Conversation

@andreslucena
Copy link
Copy Markdown
Member

🎩 What? Why?

While checking notifications, I saw an exception. As far as I see this was introduced with #15002 (so we need to backport to the same releases that this fix was backported to).

📌 Related Issues

Testing

  1. Sign in
  2. Unpublish and publish a component
  3. Go to http://localhost:3000/notifications

📷 Stacktrace

ActionView::Template::Error (undefined method 'can_participate?' for an instance of Decidim::Component):

Causes:
NoMethodError (undefined method 'can_participate?' for an instance of Decidim::Component)
     9:   <% main_tag = main_enabled ? :main : :div %>
    10:   <%= content_tag main_tag, class: "layout-2col__main" do %>
    11:     <%= content_for :flash_messages %>
    12:     <%= yield %>
    13:   <% end %>
    14: </div>

activemodel (7.2.2.2) lib/active_model/attribute_methods.rb:512:in 'ActiveModel::AttributeMethods#method_missing'
activerecord (7.2.2.2) lib/active_record/attribute_methods.rb:491:in 'ActiveRecord::AttributeMethods#method_missing'
/home/apereira/Work/decidim-org/decidim/decidim-core/app/models/decidim/notification.rb:41:in 'Decidim::Notification#can_participate?'
/nix/store/khiwk1y8halaw4zfrhmh5r340lwaxzlq-ruby-3.4.7/lib/ruby/3.4.0/delegate.rb:87:in 'Delegator#method_missing'
/home/apereira/Work/decidim-org/decidim/decidim-core/app/cells/decidim/notification_cell.rb:10:in 'Decidim::NotificationCell#show'
cells (4.1.8) lib/cell/view_model.rb:114:in 'Cell::ViewModel::Rendering#render_state'
cells (4.1.8) lib/cell/caching.rb:46:in 'Cell::Caching#render_state'
cells (4.1.8) lib/cell/view_model.rb:92:in 'Cell::ViewModel::Rendering#call'
cells-rails (0.1.6) lib/cell/rails.rb:56:in 'Cell::RailsExtensions::ViewModel#call'
/home/apereira/Work/decidim-org/decidim/decidim-core/lib/decidim/view_model.rb:34:in 'block in Decidim::ViewModel#call'
/home/apereira/Work/decidim-org/decidim/decidim-core/lib/decidim/view_model.rb:81:in 'block in Decidim::ViewModel#instrument'
activesupport (7.2.2.2) lib/active_support/notifications.rb:210:in 'block in ActiveSupport::Notifications.instrument'
activesupport (7.2.2.2) lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument'
activesupport (7.2.2.2) lib/active_support/notifications.rb:210:in 'ActiveSupport::Notifications.instrument'
/home/apereira/Work/decidim-org/decidim/decidim-core/lib/decidim/view_model.rb:80:in 'Decidim::ViewModel#instrument'
/home/apereira/Work/decidim-org/decidim/decidim-core/lib/decidim/view_model.rb:33:in 'Decidim::ViewModel#call'

♥️ Thank you!

@andreslucena andreslucena added type: fix PRs that implement a fix for a bug 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 Dec 20, 2025
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

@alecslupu
Copy link
Copy Markdown
Contributor

@andreslucena this notification is happening only when the component is new ( never published before )

@alecslupu alecslupu merged commit 9c82ca2 into develop Dec 20, 2025
89 of 92 checks passed
@alecslupu alecslupu deleted the fix/component-notification branch December 20, 2025 22:12
alecslupu pushed a commit to i-need-another-coffee/decidim-api that referenced this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core 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.

2 participants