]> source.dussan.org Git - redmine.git/commitdiff
Ability to set default value for "I don't want to be notified of changes that I make...
authorGo MAEDA <maeda@farend.jp>
Wed, 10 Mar 2021 03:35:22 +0000 (03:35 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 10 Mar 2021 03:35:22 +0000 (03:35 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@20771 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user_preference.rb
app/views/settings/_users.html.erb
config/settings.yml
test/unit/user_preference_test.rb

index 4c36e5ef7e096c425e42674c2a8b588d8308be71..91261e1c7ec116319692ac52b4246ac8a50a6d6e 100644 (file)
@@ -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 ||= {}
index 11c2aadac3b22265f81c7625a00712a302015088..2ae55b1a32727cb1cd239ae13d6aca49cda8c7e3 100644 (file)
@@ -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>
 
index 5c11d1f57ca25cc543b60e6fb1f16d7c24e870c0..83685a04ac4448067a22d44ea9e1c7da73e1e80b 100644 (file)
@@ -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
index a95d7a9f75d1d4b1c6992e8f84fa1d1c4da5ea42..08c00a84e92471732870966cacf9b3135be98f97 100644 (file)
@@ -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"