diff options
-rw-r--r-- | config/settings.yml | 2 | ||||
-rw-r--r-- | db/migrate/017_create_settings.rb | 4 | ||||
-rw-r--r-- | db/migrate/20221004172825_ensure_text_formatting_setting_is_stored_in_db.rb | 8 | ||||
-rw-r--r-- | test/functional/attachments_controller_test.rb | 2 | ||||
-rw-r--r-- | test/unit/setting_test.rb | 5 |
5 files changed, 19 insertions, 2 deletions
diff --git a/config/settings.yml b/config/settings.yml index 0c41b7eda..78025b2e7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -95,7 +95,7 @@ mail_from: plain_text_mail: default: 0 text_formatting: - default: textile + default: common_mark cache_formatted_text: default: 0 wiki_compression: diff --git a/db/migrate/017_create_settings.rb b/db/migrate/017_create_settings.rb index 777e36ed6..4c18329cc 100644 --- a/db/migrate/017_create_settings.rb +++ b/db/migrate/017_create_settings.rb @@ -4,6 +4,10 @@ class CreateSettings < ActiveRecord::Migration[4.2] t.column "name", :string, :limit => 30, :default => "", :null => false 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! end def self.down diff --git a/db/migrate/20221004172825_ensure_text_formatting_setting_is_stored_in_db.rb b/db/migrate/20221004172825_ensure_text_formatting_setting_is_stored_in_db.rb new file mode 100644 index 000000000..bcb8130bb --- /dev/null +++ b/db/migrate/20221004172825_ensure_text_formatting_setting_is_stored_in_db.rb @@ -0,0 +1,8 @@ +class EnsureTextFormattingSettingIsStoredInDb < ActiveRecord::Migration[6.1] + def change + unless Setting.where(name: "text_formatting").exists? + setting = Setting.new(:name => "text_formatting", :value => 'textile') + setting.save! + end + end +end diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 43d7c35e0..71c54a774 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -219,7 +219,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest get(:show, :params => {:id => a.id}) assert_response :success assert_equal 'text/html', @response.media_type - assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>" + assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n<h2>Header 2</h2>\n<h3>Header 3</h3>" end def test_show_text_file_formatted_textile diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb index f8d35a6a6..5d4986760 100644 --- a/test/unit/setting_test.rb +++ b/test/unit/setting_test.rb @@ -145,4 +145,9 @@ class SettingTest < ActiveSupport::TestCase end end end + + def test_default_text_formatting_for_new_installations_is_common_mark + assert_equal 'common_mark', Setting.text_formatting + assert_equal 'common_mark', Setting.find_by(:name => 'text_formatting').value + end end |