@@ -39,6 +39,9 class UserPreference < ActiveRecord::Base | |||
|
39 | 39 | if new_record? && !(attributes && attributes.key?(:hide_mail)) |
|
40 | 40 | self.hide_mail = Setting.default_users_hide_mail? |
|
41 | 41 | end |
|
42 | if new_record? && !(attributes && attributes.key?(:time_zone)) | |
|
43 | self.time_zone = Setting.default_users_time_zone | |
|
44 | end | |
|
42 | 45 | if new_record? && !(attributes && attributes.key?(:no_self_notified)) |
|
43 | 46 | self.no_self_notified = true |
|
44 | 47 | end |
@@ -41,6 +41,8 | |||
|
41 | 41 | |
|
42 | 42 | <div class="tabular settings"> |
|
43 | 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 | 46 | </div> |
|
45 | 47 | </fieldset> |
|
46 | 48 |
@@ -236,6 +236,8 sequential_project_identifiers: | |||
|
236 | 236 | # multiple values accepted, comma separated |
|
237 | 237 | default_users_hide_mail: |
|
238 | 238 | default: 1 |
|
239 | default_users_time_zone: | |
|
240 | default: "" | |
|
239 | 241 | repositories_encodings: |
|
240 | 242 | default: '' |
|
241 | 243 | # encoding used to convert commit logs to UTF-8 |
@@ -32,6 +32,13 class UserPreferenceTest < ActiveSupport::TestCase | |||
|
32 | 32 | end |
|
33 | 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 | 42 | def test_no_self_notified_should_default_to_true |
|
36 | 43 | preference = UserPreference.new |
|
37 | 44 | assert_equal true, preference.no_self_notified |
General Comments 0
You need to be logged in to leave comments.
Login now