diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-15 17:52:41 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-15 17:52:41 +0000 |
commit | d21627b70f5431de33a8c532b7b73799c5ae1700 (patch) | |
tree | 0b4b700e6b7093f085408d93a508ec363d28fed7 /app | |
parent | 945f3f949d40ef3ef2e0a394b6f9062818029127 (diff) | |
download | redmine-d21627b70f5431de33a8c532b7b73799c5ae1700.tar.gz redmine-d21627b70f5431de33a8c532b7b73799c5ae1700.zip |
Clear settings for blocks that are no longer used.
git-svn-id: http://svn.redmine.org/redmine/trunk@16405 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user_preference.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 0ebafa839..e0b17631c 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -23,7 +23,7 @@ class UserPreference < ActiveRecord::Base attr_protected :others, :user_id - before_save :set_others_hash + before_save :set_others_hash, :clear_unused_block_settings safe_attributes 'hide_mail', 'time_zone', @@ -132,4 +132,10 @@ class UserPreference < ActiveRecord::Base block_settings = my_page_settings(block).merge(settings.symbolize_keys) my_page_settings[block] = block_settings end + + def clear_unused_block_settings + blocks = my_page_layout.values.flatten + my_page_settings.keep_if {|block, settings| blocks.include?(block)} + end + private :clear_unused_block_settings end |