@@ -120,9 +120,11 class Setting < ActiveRecord::Base | |||
|
120 | 120 | |
|
121 | 121 | # Updates multiple settings from params and sends a security notification if needed |
|
122 | 122 | def self.set_all_from_params(settings) |
|
123 | settings = (settings || {}).dup.symbolize_keys | |
|
123 | return false unless settings.is_a?(Hash) | |
|
124 | settings = settings.dup.symbolize_keys | |
|
124 | 125 | changes = [] |
|
125 | 126 | settings.each do |name, value| |
|
127 | next unless available_settings[name.to_s] | |
|
126 | 128 | previous_value = Setting[name] |
|
127 | 129 | set_from_params name, value |
|
128 | 130 | if available_settings[name.to_s]['security_notifications'] && Setting[name] != previous_value |
@@ -145,6 +145,15 class SettingsControllerTest < Redmine::ControllerTest | |||
|
145 | 145 | ], Setting.commit_update_keywords) |
|
146 | 146 | end |
|
147 | 147 | |
|
148 | def test_post_edit_with_invalid_setting_should_not_error | |
|
149 | post :edit, :params => { | |
|
150 | :settings => { | |
|
151 | :invalid_setting => '1' | |
|
152 | } | |
|
153 | } | |
|
154 | assert_redirected_to '/settings' | |
|
155 | end | |
|
156 | ||
|
148 | 157 | def test_post_edit_should_send_security_notification_for_notified_settings |
|
149 | 158 | ActionMailer::Base.deliveries.clear |
|
150 | 159 | post :edit, :params => { |
General Comments 0
You need to be logged in to leave comments.
Login now