Allow set_default to set value only if empty and writable

https://community.openproject.org/wp/44755
pull/11563/head
Oliver Günther 2 years ago
parent 12a422aff6
commit 1db56d8baa
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 19
      app/seeders/demo_data/project_seeder.rb

@ -93,13 +93,22 @@ module DemoData
end
def seed_settings
seedable_welcome_settings
.select { |k,| Settings::Definition[k].writable? }
.each do |k, v|
Setting[k] = v
end
end
def seedable_welcome_settings
welcome = demo_data_for('welcome')
return {} if welcome.blank?
if welcome.present?
Setting.welcome_title = welcome[:title]
Setting.welcome_text = welcome[:text]
Setting.welcome_on_homescreen = 1
end
{
welcome_title: welcome[:title],
welcome_text: welcome[:text],
welcome_on_homescreen: 1
}
end
def reset_project(key)

Loading…
Cancel
Save