diff --git a/decidim-consultations/app/permissions/decidim/consultations/permissions.rb b/decidim-consultations/app/permissions/decidim/consultations/permissions.rb index 2d3c8b5f7301..e54eb654c957 100644 --- a/decidim-consultations/app/permissions/decidim/consultations/permissions.rb +++ b/decidim-consultations/app/permissions/decidim/consultations/permissions.rb @@ -41,8 +41,12 @@ def allowed_public_anonymous_action? when :consultation_list, :participatory_space allow! when :consultation + raise ActiveRecord::RecordNotFound unless consultation + toggle_allow(consultation.published? || user&.admin?) when :question + raise ActiveRecord::RecordNotFound unless question + toggle_allow(question.published? || user&.admin?) end end diff --git a/decidim-consultations/spec/system/admin/admin_manages_question_component_spec.rb b/decidim-consultations/spec/system/admin/admin_manages_question_component_spec.rb index 9c879e718ea4..8dd5399d9c0a 100644 --- a/decidim-consultations/spec/system/admin/admin_manages_question_component_spec.rb +++ b/decidim-consultations/spec/system/admin/admin_manages_question_component_spec.rb @@ -170,6 +170,7 @@ end describe "publish and unpublish a component" do + let(:participatory_space_engine) { decidim_admin_consultations } let!(:component) do create(:component, participatory_space: question, published_at: published_at) end