decidim-ice / decidim-module-decidim_awesome

Additional components and Opt-In usability and UX tweaks for Decidim.
GNU Affero General Public License v3.0
24 stars 24 forks source link

Error when using Scoped Admins. #296

Open rsdeus opened 6 months ago

rsdeus commented 6 months ago

Describe the bug When the configuration from Scoped Admins is updated, the following error arises.

NoMethodError (undefined method `with_indifferent_access' for nil:NilClass):

decidim-core (0.27.6) lib/decidim/attribute_object/form.rb:82:in `hash_from'
decidim-core (0.27.6) lib/decidim/attribute_object/form.rb:72:in `from_params'
decidim-decidim_awesome (0.10.2) app/forms/decidim/decidim_awesome/admin/config_form.rb:50:in `from_params'
decidim-core (0.27.6) app/controllers/concerns/decidim/form_factory.rb:65:in `from_params'
decidim-decidim_awesome (0.10.2) app/controllers/decidim/decidim_awesome/admin/config_controller.rb:26:in `update'

To Reproduce Steps to reproduce the behavior:

  1. Go to the 'Decidim Awesome' tab and select 'Scoped Admins'.
  2. Click on 'Add a new "Scoped Admins" group'.
  3. Click on 'Update configuration'.
  4. Check for errors in the log file or browser if in a development environment.

Expected behavior The configuration update

Desktop (please complete the following information):

Additional context Modifying the code at line 26 in the config_controller.rb file. from: @form = form(ConfigForm).from_params(params[:config]) to: @form = form(ConfigForm).from_params(params[:config] || {})

Solves the problem.