##// END OF EJS Templates
Add default timezone for new users (#16484)....
Jean-Philippe Lang -
r15818:6d21b3c4aea8
parent child
Show More
@@ -39,6 +39,9 class UserPreference < ActiveRecord::Base
39 if new_record? && !(attributes && attributes.key?(:hide_mail))
39 if new_record? && !(attributes && attributes.key?(:hide_mail))
40 self.hide_mail = Setting.default_users_hide_mail?
40 self.hide_mail = Setting.default_users_hide_mail?
41 end
41 end
42 if new_record? && !(attributes && attributes.key?(:time_zone))
43 self.time_zone = Setting.default_users_time_zone
44 end
42 if new_record? && !(attributes && attributes.key?(:no_self_notified))
45 if new_record? && !(attributes && attributes.key?(:no_self_notified))
43 self.no_self_notified = true
46 self.no_self_notified = true
44 end
47 end
@@ -41,6 +41,8
41
41
42 <div class="tabular settings">
42 <div class="tabular settings">
43 <p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
43 <p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
44
45 <p><%= setting_select :default_users_time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :label => :field_time_zone, :blank => :label_none %></p>
44 </div>
46 </div>
45 </fieldset>
47 </fieldset>
46
48
@@ -236,6 +236,8 sequential_project_identifiers:
236 # multiple values accepted, comma separated
236 # multiple values accepted, comma separated
237 default_users_hide_mail:
237 default_users_hide_mail:
238 default: 1
238 default: 1
239 default_users_time_zone:
240 default: ""
239 repositories_encodings:
241 repositories_encodings:
240 default: ''
242 default: ''
241 # encoding used to convert commit logs to UTF-8
243 # encoding used to convert commit logs to UTF-8
@@ -32,6 +32,13 class UserPreferenceTest < ActiveSupport::TestCase
32 end
32 end
33 end
33 end
34
34
35 def test_time_zone_should_default_to_setting
36 with_settings :default_users_time_zone => 'Paris' do
37 preference = UserPreference.new
38 assert_equal 'Paris', preference.time_zone
39 end
40 end
41
35 def test_no_self_notified_should_default_to_true
42 def test_no_self_notified_should_default_to_true
36 preference = UserPreference.new
43 preference = UserPreference.new
37 assert_equal true, preference.no_self_notified
44 assert_equal true, preference.no_self_notified
General Comments 0
You need to be logged in to leave comments. Login now