summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-03-10 03:35:22 +0000
committerGo MAEDA <maeda@farend.jp>2021-03-10 03:35:22 +0000
commit34310eece6a60322e29ee67e44c7a6f9dfe69ef3 (patch)
tree73f0819068e0e0f29b09eb45d8050809c27b5249
parent7152e5b9df3b0efd4b3db0f9b9ab1b0efd7e8185 (diff)
downloadredmine-34310eece6a60322e29ee67e44c7a6f9dfe69ef3.tar.gz
redmine-34310eece6a60322e29ee67e44c7a6f9dfe69ef3.zip
Ability to set default value for "I don't want to be notified of changes that I make myself" (#34787).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20771 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/user_preference.rb2
-rw-r--r--app/views/settings/_users.html.erb2
-rw-r--r--config/settings.yml2
-rw-r--r--test/unit/user_preference_test.rb7
4 files changed, 12 insertions, 1 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 4c36e5ef7..91261e1c7 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -52,7 +52,7 @@ class UserPreference < ActiveRecord::Base
self.time_zone = Setting.default_users_time_zone
end
unless attributes && attributes.key?(:no_self_notified)
- self.no_self_notified = true
+ self.no_self_notified = Setting.default_users_no_self_notified
end
end
self.others ||= {}
diff --git a/app/views/settings/_users.html.erb b/app/views/settings/_users.html.erb
index 11c2aadac..2ae55b1a3 100644
--- a/app/views/settings/_users.html.erb
+++ b/app/views/settings/_users.html.erb
@@ -19,6 +19,8 @@
<p><%= setting_select(:default_notification_option, User.valid_notification_options.collect {|o| [l(o.last), o.first.to_s]}) %></p>
+ <p><%= setting_check_box :default_users_no_self_notified, :label => :label_user_mail_no_self_notified %></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>
</fieldset>
diff --git a/config/settings.yml b/config/settings.yml
index 5c11d1f57..83685a04a 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -277,6 +277,8 @@ sequential_project_identifiers:
default: 0
default_users_hide_mail:
default: 1
+default_users_no_self_notified:
+ default: 1
default_users_time_zone:
default: ""
# encodings used to convert files content to UTF-8
diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb
index a95d7a9f7..08c00a84e 100644
--- a/test/unit/user_preference_test.rb
+++ b/test/unit/user_preference_test.rb
@@ -50,6 +50,13 @@ class UserPreferenceTest < ActiveSupport::TestCase
assert_equal true, preference.no_self_notified
end
+ def test_no_self_notified_should_default_to_setting
+ with_settings :default_users_no_self_notified => '0' do
+ preference = UserPreference.new
+ assert_equal false, preference.no_self_notified
+ end
+ end
+
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"