diff options
author | Go MAEDA <maeda@farend.jp> | 2023-12-11 09:20:06 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-12-11 09:20:06 +0000 |
commit | 9935af7e019c4b833fa4fbfeb743044af36b877c (patch) | |
tree | 55845850398b85b554e253528d8a0b30b31d94c8 /db/migrate | |
parent | 21423d4b7f49284ea4f76afe1939fdc2693d5742 (diff) | |
download | redmine-9935af7e019c4b833fa4fbfeb743044af36b877c.tar.gz redmine-9935af7e019c4b833fa4fbfeb743044af36b877c.zip |
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
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/017_create_settings.rb | 6 | ||||
-rw-r--r-- | db/migrate/20231113131245_ensure_default_notification_option_is_stored_in_db.rb | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/db/migrate/017_create_settings.rb b/db/migrate/017_create_settings.rb index 4c18329cc..5768ca24c 100644 --- a/db/migrate/017_create_settings.rb +++ b/db/migrate/017_create_settings.rb @@ -5,9 +5,9 @@ class CreateSettings < ActiveRecord::Migration[4.2] 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 diff --git a/db/migrate/20231113131245_ensure_default_notification_option_is_stored_in_db.rb b/db/migrate/20231113131245_ensure_default_notification_option_is_stored_in_db.rb new file mode 100644 index 000000000..0cad1982b --- /dev/null +++ b/db/migrate/20231113131245_ensure_default_notification_option_is_stored_in_db.rb @@ -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 |