Index: app/models/user_preference.rb
===================================================================
--- app/models/user_preference.rb (revision 15058)
+++ app/models/user_preference.rb (working copy)
@@ -25,8 +25,13 @@
def initialize(attributes=nil, *args)
super
- if new_record? && !(attributes && attributes.key?(:hide_mail))
- self.hide_mail = Setting.default_users_hide_mail?
+ if new_record?
+ if !(attributes && attributes.key?(:hide_mail))
+ self.hide_mail = Setting.default_users_hide_mail?
+ end
+ if !(attributes && attributes.key?(:no_self_notified))
+ self.no_self_notified = !Setting.default_users_self_notification?
+ end
end
self.others ||= {}
end
Index: app/views/settings/_authentication.html.erb
===================================================================
--- app/views/settings/_authentication.html.erb (revision 15058)
+++ app/views/settings/_authentication.html.erb (working copy)
@@ -41,6 +41,7 @@
<%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %>
+
<%= setting_check_box :default_users_self_notification, :label => :field_self_notification %>
Index: config/locales/en.yml
===================================================================
--- config/locales/en.yml (revision 15058)
+++ config/locales/en.yml (working copy)
@@ -295,6 +295,7 @@
field_done_ratio: "% Done"
field_auth_source: Authentication mode
field_hide_mail: Hide my email address
+ field_self_notification: Email self notification
field_comments: Comment
field_url: URL
field_start_page: Start page
Index: config/settings.yml
===================================================================
--- config/settings.yml (revision 15058)
+++ config/settings.yml (working copy)
@@ -219,6 +219,8 @@
# multiple values accepted, comma separated
default_users_hide_mail:
default: 1
+default_users_self_notification:
+ default: 1
repositories_encodings:
default: ''
# encoding used to convert commit logs to UTF-8
Index: test/unit/user_preference_test.rb
===================================================================
--- test/unit/user_preference_test.rb (revision 15058)
+++ test/unit/user_preference_test.rb (working copy)
@@ -32,6 +32,18 @@
end
end
+ def test_self_notification_should_default_to_true
+ preference = UserPreference.new
+ assert_equal true, preference.self_notification
+ end
+
+ def test_self_notification_should_default_to_false_with_setting
+ with_settings :default_users_self_notification => '0' do
+ preference = UserPreference.new
+ assert_equal false, preference.self_notification
+ end
+ end
+
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"