docbrown/lib/data_update_scripts/20201218080343_update_default_email_addresses.rb
Michael Kohl 6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00

17 lines
704 B
Ruby

module DataUpdateScripts
class UpdateDefaultEmailAddresses
def run
return if Settings::General.email_addresses[:contact].present?
# In order to trigger the attribute setter on the Settings::General hash object,
# it seems like we need to set all the values in the hash and not only the one we are changing.
Settings::General.email_addresses = {
default: Settings::General.email_addresses[:default],
business: Settings::General.email_addresses[:business],
privacy: Settings::General.email_addresses[:privacy],
members: Settings::General.email_addresses[:members],
contact: ApplicationConfig["DEFAULT_EMAIL"]
}
end
end
end