diff options
-rw-r--r-- | app/models/user_preference.rb | 3 | ||||
-rw-r--r-- | app/views/settings/_authentication.html.erb | 8 | ||||
-rw-r--r-- | config/locales/en.yml | 1 | ||||
-rw-r--r-- | config/locales/fr.yml | 1 | ||||
-rw-r--r-- | config/settings.yml | 2 | ||||
-rw-r--r-- | test/unit/user_preference_test.rb | 7 |
6 files changed, 22 insertions, 0 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 80b3e6b9d..6e7876abb 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -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 diff --git a/app/views/settings/_authentication.html.erb b/app/views/settings/_authentication.html.erb index f9c569cb8..35aa66425 100644 --- a/app/views/settings/_authentication.html.erb +++ b/app/views/settings/_authentication.html.erb @@ -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 %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 24d5fe7c4..7d98034f6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4ec1d3368..43873caf3 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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 diff --git a/config/settings.yml b/config/settings.yml index 7180dac3f..5031b68d3 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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 diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb index c76862408..bfdcd185a 100644 --- a/test/unit/user_preference_test.rb +++ b/test/unit/user_preference_test.rb @@ -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" |