docbrown/lib/data_update_scripts/20201218080343_update_default_email_addresses.rb
Ridhwana c8e56853b7
Updates the email_addresses hash with the contact info (#11967)
* feat: add a new script that updates the email_addresses hash with the contact key

* add a comment to old data script

* feat: add a spec (not passing as yet)

* fix: test passing

* chore: comment script with reason
2020-12-18 18:07:48 +02:00

17 lines
655 B
Ruby

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