Feature #39500 » 0002-Change-the-default-notification-option-from-only_my_.patch
| config/settings.yml | ||
|---|---|---|
|
default: 0
|
||
|
security_notifications: 1
|
||
|
default_notification_option:
|
||
|
default: 'only_my_events'
|
||
|
default: 'only_assigned'
|
||
|
emails_header:
|
||
|
default: ''
|
||
|
thumbnails_enabled:
|
||
| db/migrate/017_create_settings.rb | ||
|---|---|---|
|
t.column "value", :text
|
||
|
end
|
||
|
# Persist text_formatting default setting for new installations
|
||
|
setting = Setting.new(:name => "text_formatting", :value => Setting.text_formatting)
|
||
|
setting.save!
|
||
|
# Persist default settings for new installations
|
||
|
Setting.create!(name: 'default_notification_option', value: Setting.default_notification_option)
|
||
|
Setting.create!(name: 'text_formatting', value: Setting.text_formatting)
|
||
|
end
|
||
|
def self.down
|
||
| db/migrate/20231113131245_ensure_default_notification_option_is_stored_in_db.rb | ||
|---|---|---|
|
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
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
end
|
||
|
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.recipients.include?(issue.author.mail)
|
||
|
end
|
||
| test/unit/user_test.rb | ||
|---|---|---|
|
def test_user_before_create_should_set_the_mail_notification_to_the_default_setting
|
||
|
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
|
||
|
user2 = User.generate!
|
||
|
assert_equal 'all', user2.mail_notification
|
||
- « Previous
- 1
- 2
- Next »