mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Don't error if an invalid setting is given.
git-svn-id: http://svn.redmine.org/redmine/trunk@15730 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fcd8ace743
commit
596a196f2e
@ -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 => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user