##// END OF EJS Templates
Wrap conditions with a single if new_record?....
Jean-Philippe Lang -
r15819:ae99ecd54fce
parent child
Show More
@@ -36,15 +36,17 class UserPreference < ActiveRecord::Base
36
36
37 def initialize(attributes=nil, *args)
37 def initialize(attributes=nil, *args)
38 super
38 super
39 if new_record? && !(attributes && attributes.key?(:hide_mail))
39 if new_record?
40 unless attributes && attributes.key?(:hide_mail)
40 self.hide_mail = Setting.default_users_hide_mail?
41 self.hide_mail = Setting.default_users_hide_mail?
41 end
42 end
42 if new_record? && !(attributes && attributes.key?(:time_zone))
43 unless attributes && attributes.key?(:time_zone)
43 self.time_zone = Setting.default_users_time_zone
44 self.time_zone = Setting.default_users_time_zone
44 end
45 end
45 if new_record? && !(attributes && attributes.key?(:no_self_notified))
46 unless attributes && attributes.key?(:no_self_notified)
46 self.no_self_notified = true
47 self.no_self_notified = true
47 end
48 end
49 end
48 self.others ||= {}
50 self.others ||= {}
49 end
51 end
50
52
General Comments 0
You need to be logged in to leave comments. Login now