diff options
author | David Yip <yipdw@member.fsf.org> | 2018-01-10 12:49:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-10 12:49:43 -0600 |
commit | 26f054253c5071d6d56d85f6bc185ae1fc677649 (patch) | |
tree | f099afd931c3c5f625c5fcf39d1d853cafcc9c56 /app | |
parent | 095a00ef3d6ed5845e331dc1e2b78fd42d861dd6 (diff) | |
parent | 395e64e8580e8232b817b6278ea28a7c523bd6f7 (diff) |
Merge pull request #319 from glitch-soc/317-attempt-to-switch-flavors-raises-actioncontroller-parametermissing
Fix #317: Attempting to switch flavors raises ActionController::ParameterMissing
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/settings/flavours_controller.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/controllers/settings/flavours_controller.rb b/app/controllers/settings/flavours_controller.rb index 865d5a479..634387715 100644 --- a/app/controllers/settings/flavours_controller.rb +++ b/app/controllers/settings/flavours_controller.rb @@ -1,13 +1,12 @@ # frozen_string_literal: true class Settings::FlavoursController < Settings::BaseController - def index redirect_to action: 'show', flavour: current_flavour end def show - unless Themes.instance.flavours.include?(params[:flavour]) or params[:flavour] == current_flavour + unless Themes.instance.flavours.include?(params[:flavour]) || (params[:flavour] == current_flavour) redirect_to action: 'show', flavour: current_flavour end @@ -16,7 +15,7 @@ class Settings::FlavoursController < Settings::BaseController end def update - user_settings.update(user_settings_params(params[:flavour]).to_h) + user_settings.update(user_settings_params) redirect_to action: 'show', flavour: params[:flavour] end @@ -26,10 +25,8 @@ class Settings::FlavoursController < Settings::BaseController UserSettingsDecorator.new(current_user) end - def user_settings_params(flavour) - params.require(:user).merge({ setting_flavour: flavour }).permit( - :setting_flavour, - :setting_skin - ) + def user_settings_params + { setting_flavour: params.require(:flavour), + setting_skin: params.dig(:user, :setting_skin) }.with_indifferent_access end end |