Commit 08e1746d authored by jplang's avatar jplang

Wrap conditions with a single if new_record?.

git-svn-id: https://svn.redmine.org/redmine/trunk@16201 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent a7050b11
......@@ -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
......
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