Commit 88c099a5 authored by jplang's avatar jplang

Don't error if an invalid setting is given.

git-svn-id: https://svn.redmine.org/redmine/trunk@15730 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 1b8409d5
......@@ -120,9 +120,11 @@ class Setting < ActiveRecord::Base
# Updates multiple settings from params and sends a security notification if needed
def self.set_all_from_params(settings)
settings = (settings || {}).dup.symbolize_keys
return false unless settings.is_a?(Hash)
settings = settings.dup.symbolize_keys
changes = []
settings.each do |name, value|
next unless available_settings[name.to_s]
previous_value = Setting[name]
set_from_params name, value
if available_settings[name.to_s]['security_notifications'] && Setting[name] != previous_value
......
......@@ -145,6 +145,15 @@ class SettingsControllerTest < Redmine::ControllerTest
], Setting.commit_update_keywords)
end
def test_post_edit_with_invalid_setting_should_not_error
post :edit, :params => {
:settings => {
:invalid_setting => '1'
}
}
assert_redirected_to '/settings'
end
def test_post_edit_should_send_security_notification_for_notified_settings
ActionMailer::Base.deliveries.clear
post :edit, :params => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment