Commit c8b1a966 authored by jplang's avatar jplang

Option to show email adresses by default for new users (#21447).

git-svn-id: https://svn.redmine.org/redmine/trunk@14974 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent f33455b2
......@@ -25,6 +25,9 @@ class UserPreference < ActiveRecord::Base
def initialize(attributes=nil, *args)
super
if new_record? && !(attributes && attributes.key?(:hide_mail))
self.hide_mail = Setting.default_users_hide_mail?
end
self.others ||= {}
end
......
......@@ -36,5 +36,13 @@
<p><em class="info"><%= l(:text_session_expiration_settings) %></em></p>
</fieldset>
<fieldset class="box">
<legend><%= l(:label_default_values_for_new_users) %></legend>
<div class="tabular settings">
<p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
</div>
</fieldset>
<%= submit_tag l(:button_save) %>
<% end %>
......@@ -975,6 +975,7 @@ en:
label_create_missing_values: Create missing values
label_api: API
label_field_format_enumeration: Key/value list
label_default_values_for_new_users: Default values for new users
button_login: Login
button_submit: Submit
......
......@@ -993,6 +993,7 @@ fr:
label_create_missing_values: Créer les valeurs manquantes
label_api: API
label_field_format_enumeration: Liste clé/valeur
label_default_values_for_new_users: Valeurs par défaut pour les nouveaux utilisateurs
button_login: Connexion
button_submit: Soumettre
......
......@@ -217,6 +217,8 @@ sequential_project_identifiers:
default: 0
# encodings used to convert repository files content to UTF-8
# multiple values accepted, comma separated
default_users_hide_mail:
default: 1
repositories_encodings:
default: ''
# encoding used to convert commit logs to UTF-8
......
......@@ -25,6 +25,13 @@ class UserPreferenceTest < ActiveSupport::TestCase
assert_equal true, preference.hide_mail
end
def test_hide_mail_should_default_to_false_with_setting
with_settings :default_users_hide_mail => '0' do
preference = UserPreference.new
assert_equal false, preference.hide_mail
end
end
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"
......
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