summaryrefslogtreecommitdiffstats
path: root/app/models/user_preference.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-15 12:58:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-15 12:58:07 +0000
commitae99ecd54fce136022a55f89c2eb1be18ca86f58 (patch)
tree062b2886786ffe0c796824d0b778b2c9b845dc67 /app/models/user_preference.rb
parent6d21b3c4aea80589c3c6bbda2957edf098e10ec9 (diff)
downloadredmine-ae99ecd54fce136022a55f89c2eb1be18ca86f58.tar.gz
redmine-ae99ecd54fce136022a55f89c2eb1be18ca86f58.zip
Wrap conditions with a single if new_record?.
git-svn-id: http://svn.redmine.org/redmine/trunk@16201 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user_preference.rb')
-rw-r--r--app/models/user_preference.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index b2d336a20..41c0f0b4b 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -36,14 +36,16 @@ class UserPreference < ActiveRecord::Base
def initialize(attributes=nil, *args)
super
- if new_record? && !(attributes && attributes.key?(:hide_mail))
- self.hide_mail = Setting.default_users_hide_mail?
- end
- if new_record? && !(attributes && attributes.key?(:time_zone))
- self.time_zone = Setting.default_users_time_zone
- end
- if new_record? && !(attributes && attributes.key?(:no_self_notified))
- self.no_self_notified = true
+ if new_record?
+ unless attributes && attributes.key?(:hide_mail)
+ self.hide_mail = Setting.default_users_hide_mail?
+ end
+ unless attributes && attributes.key?(:time_zone)
+ self.time_zone = Setting.default_users_time_zone
+ end
+ unless attributes && attributes.key?(:no_self_notified)
+ self.no_self_notified = true
+ end
end
self.others ||= {}
end