mirror of
				https://github.com/redmine/redmine.git
				synced 2025-11-03 20:06:24 +01:00 
			
		
		
		
	Change the default notification option from only_my_events to only_assigned (#39500).
				
					
				
			Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22512 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
		@@ -314,7 +314,7 @@ jsonp_enabled:
 | 
				
			|||||||
  default: 0
 | 
					  default: 0
 | 
				
			||||||
  security_notifications: 1
 | 
					  security_notifications: 1
 | 
				
			||||||
default_notification_option:
 | 
					default_notification_option:
 | 
				
			||||||
  default: 'only_my_events'
 | 
					  default: 'only_assigned'
 | 
				
			||||||
emails_header:
 | 
					emails_header:
 | 
				
			||||||
  default: ''
 | 
					  default: ''
 | 
				
			||||||
thumbnails_enabled:
 | 
					thumbnails_enabled:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,9 +5,9 @@ class CreateSettings < ActiveRecord::Migration[4.2]
 | 
				
			|||||||
      t.column "value", :text
 | 
					      t.column "value", :text
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Persist text_formatting default setting for new installations
 | 
					    # Persist default settings for new installations
 | 
				
			||||||
    setting = Setting.new(:name => "text_formatting", :value => Setting.text_formatting)
 | 
					    Setting.create!(name: 'default_notification_option', value: Setting.default_notification_option)
 | 
				
			||||||
    setting.save!
 | 
					    Setting.create!(name: 'text_formatting', value: Setting.text_formatting)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def self.down
 | 
					  def self.down
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					class EnsureDefaultNotificationOptionIsStoredInDb < ActiveRecord::Migration[6.1]
 | 
				
			||||||
 | 
					  def up
 | 
				
			||||||
 | 
					    # Set the default value in Redmine <= 5.1 to preserve the behavior of existing installations
 | 
				
			||||||
 | 
					    Setting.find_or_create_by!(name: 'default_notification_option') do |setting|
 | 
				
			||||||
 | 
					      setting.value = 'only_my_events'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def down
 | 
				
			||||||
 | 
					    # no-op
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -3017,7 +3017,7 @@ class IssueTest < ActiveSupport::TestCase
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test "Issue#recipients should include the author if the author is active" do
 | 
					  test "Issue#recipients should include the author if the author is active" do
 | 
				
			||||||
    issue = Issue.generate!(:author => User.generate!)
 | 
					    issue = Issue.generate!(:author => User.generate!(:mail_notification => 'only_my_events'))
 | 
				
			||||||
    assert issue.author, "No author set for Issue"
 | 
					    assert issue.author, "No author set for Issue"
 | 
				
			||||||
    assert issue.recipients.include?(issue.author.mail)
 | 
					    assert issue.recipients.include?(issue.author.mail)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -192,7 +192,7 @@ class UserTest < ActiveSupport::TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  def test_user_before_create_should_set_the_mail_notification_to_the_default_setting
 | 
					  def test_user_before_create_should_set_the_mail_notification_to_the_default_setting
 | 
				
			||||||
    user1 = User.generate!
 | 
					    user1 = User.generate!
 | 
				
			||||||
    assert_equal 'only_my_events', user1.mail_notification
 | 
					    assert_equal 'only_assigned', user1.mail_notification
 | 
				
			||||||
    with_settings :default_notification_option => 'all' do
 | 
					    with_settings :default_notification_option => 'all' do
 | 
				
			||||||
      user2 = User.generate!
 | 
					      user2 = User.generate!
 | 
				
			||||||
      assert_equal 'all', user2.mail_notification
 | 
					      assert_equal 'all', user2.mail_notification
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user