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,14 +36,16 @@ 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?
self.hide_mail = Setting.default_users_hide_mail? unless attributes && attributes.key?(:hide_mail)
end self.hide_mail = Setting.default_users_hide_mail?
if new_record? && !(attributes && attributes.key?(:time_zone)) end
self.time_zone = Setting.default_users_time_zone unless attributes && attributes.key?(:time_zone)
end self.time_zone = Setting.default_users_time_zone
if new_record? && !(attributes && attributes.key?(:no_self_notified)) end
self.no_self_notified = true unless attributes && attributes.key?(:no_self_notified)
self.no_self_notified = true
end
end end
self.others ||= {} self.others ||= {}
end end