Commit a7050b11 authored by jplang's avatar jplang

Add default timezone for new users (#16484).

git-svn-id: https://svn.redmine.org/redmine/trunk@16200 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 6dd1252b
......@@ -39,6 +39,9 @@ class UserPreference < ActiveRecord::Base
if new_record? && !(attributes && attributes.key?(:hide_mail))
self.hide_mail = Setting.default_users_hide_mail?
end
if new_record? && !(attributes && attributes.key?(:time_zone))
self.time_zone = Setting.default_users_time_zone
end
if new_record? && !(attributes && attributes.key?(:no_self_notified))
self.no_self_notified = true
end
......
......@@ -41,6 +41,8 @@
<div class="tabular settings">
<p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
<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>
</div>
</fieldset>
......
......@@ -236,6 +236,8 @@ sequential_project_identifiers:
# multiple values accepted, comma separated
default_users_hide_mail:
default: 1
default_users_time_zone:
default: ""
repositories_encodings:
default: ''
# encoding used to convert commit logs to UTF-8
......
......@@ -32,6 +32,13 @@ class UserPreferenceTest < ActiveSupport::TestCase
end
end
def test_time_zone_should_default_to_setting
with_settings :default_users_time_zone => 'Paris' do
preference = UserPreference.new
assert_equal 'Paris', preference.time_zone
end
end
def test_no_self_notified_should_default_to_true
preference = UserPreference.new
assert_equal true, preference.no_self_notified
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment