1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Wrap conditions with a single if new_record?.

git-svn-id: http://svn.redmine.org/redmine/trunk@16201 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-01-15 12:58:07 +00:00
parent 6d21b3c4ae
commit ae99ecd54f

View File

@ -36,15 +36,17 @@ class UserPreference < ActiveRecord::Base
def initialize(attributes=nil, *args) def initialize(attributes=nil, *args)
super super
if new_record? && !(attributes && attributes.key?(:hide_mail)) if new_record?
unless attributes && attributes.key?(:hide_mail)
self.hide_mail = Setting.default_users_hide_mail? self.hide_mail = Setting.default_users_hide_mail?
end end
if new_record? && !(attributes && attributes.key?(:time_zone)) unless attributes && attributes.key?(:time_zone)
self.time_zone = Setting.default_users_time_zone self.time_zone = Setting.default_users_time_zone
end end
if new_record? && !(attributes && attributes.key?(:no_self_notified)) unless attributes && attributes.key?(:no_self_notified)
self.no_self_notified = true self.no_self_notified = true
end end
end
self.others ||= {} self.others ||= {}
end end