mirror of
https://github.com/redmine/redmine.git
synced 2025-12-15 21:10:27 +01:00
Add default timezone for new users (#16484).
git-svn-id: http://svn.redmine.org/redmine/trunk@16200 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -39,6 +39,9 @@ class UserPreference < ActiveRecord::Base
|
|||||||
if new_record? && !(attributes && attributes.key?(:hide_mail))
|
if new_record? && !(attributes && attributes.key?(:hide_mail))
|
||||||
self.hide_mail = Setting.default_users_hide_mail?
|
self.hide_mail = Setting.default_users_hide_mail?
|
||||||
end
|
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))
|
if new_record? && !(attributes && attributes.key?(:no_self_notified))
|
||||||
self.no_self_notified = true
|
self.no_self_notified = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
<div class="tabular settings">
|
<div class="tabular settings">
|
||||||
<p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
|
<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>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|||||||
@@ -236,6 +236,8 @@ sequential_project_identifiers:
|
|||||||
# multiple values accepted, comma separated
|
# multiple values accepted, comma separated
|
||||||
default_users_hide_mail:
|
default_users_hide_mail:
|
||||||
default: 1
|
default: 1
|
||||||
|
default_users_time_zone:
|
||||||
|
default: ""
|
||||||
repositories_encodings:
|
repositories_encodings:
|
||||||
default: ''
|
default: ''
|
||||||
# encoding used to convert commit logs to UTF-8
|
# encoding used to convert commit logs to UTF-8
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ class UserPreferenceTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
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
|
def test_no_self_notified_should_default_to_true
|
||||||
preference = UserPreference.new
|
preference = UserPreference.new
|
||||||
assert_equal true, preference.no_self_notified
|
assert_equal true, preference.no_self_notified
|
||||||
|
|||||||
Reference in New Issue
Block a user