0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 02:30:28 +01:00

stick to one method for text conversion

Dieser Commit ist enthalten in:
merefield 2023-07-19 11:14:08 +01:00
Ursprung 3fe1a7c7e8
Commit a342626267
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -64,7 +64,7 @@ class CustomWizard::Template
ensure_wizard_upload_references!(wizard_id) ensure_wizard_upload_references!(wizard_id)
PluginStore.remove(CustomWizard::PLUGIN_NAME, wizard.id) PluginStore.remove(CustomWizard::PLUGIN_NAME, wizard.id)
clear_user_wizard_redirect(wizard_id, after_time: !!wizard.after_time) clear_user_wizard_redirect(wizard_id, after_time: !!wizard.after_time)
related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: wizard.name.parameterize.underscore) related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: wizard.name.parameterize(separator: "_"))
related_custom_fields.destroy_all related_custom_fields.destroy_all
end end

Datei anzeigen

@ -5,7 +5,7 @@ describe CustomWizard::AdminWizardController do
fab!(:user1) { Fabricate(:user) } fab!(:user1) { Fabricate(:user) }
fab!(:user2) { Fabricate(:user) } fab!(:user2) { Fabricate(:user) }
let(:template) { get_wizard_fixture("wizard") } let(:template) { get_wizard_fixture("wizard") }
let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize.underscore }) } let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize(separator: "_") }) }
before do before do
CustomWizard::Template.save(template, skip_jobs: true) CustomWizard::Template.save(template, skip_jobs: true)
@ -41,11 +41,11 @@ describe CustomWizard::AdminWizardController do
end end
it "removes wizard templates whilst making sure create_topic_wizard settings for that wizard are removed from Categories" do it "removes wizard templates whilst making sure create_topic_wizard settings for that wizard are removed from Categories" do
expect(CategoryCustomField.find_by(category_id: category.id, name: 'create_topic_wizard', value: template['name'].parameterize.underscore)).not_to eq(nil) expect(CategoryCustomField.find_by(category_id: category.id, name: 'create_topic_wizard', value: template['name'].parameterize(separator: "_"))).not_to eq(nil)
delete "/admin/wizards/wizard/#{template['id']}.json" delete "/admin/wizards/wizard/#{template['id']}.json"
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(CustomWizard::Template.exists?(template['id'])).to eq(false) expect(CustomWizard::Template.exists?(template['id'])).to eq(false)
expect(CategoryCustomField.find_by(name: 'create_topic_wizard', value: template['name'].parameterize.underscore)).to eq(nil) expect(CategoryCustomField.find_by(name: 'create_topic_wizard', value: template['name'].parameterize(separator: "_"))).to eq(nil)
end end
it "saves wizard templates" do it "saves wizard templates" do