20220513083500_mark_settings_as_translatable.rb 810 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class MarkSettingsAsTranslatable < ActiveRecord::Migration[6.0]
  3. def change
  4. return if !Setting.exists?(name: 'system_init_done')
  5. settings_update = %w[
  6. postmaster_follow_up_search_in
  7. postmaster_sender_based_on_reply_to
  8. ticket_define_email_from
  9. pretty_date_format
  10. storage_provider
  11. password_min_2_lower_2_upper_characters
  12. password_need_digit
  13. password_need_special_character
  14. ]
  15. settings_update.each do |name|
  16. fetched_setting = Setting.find_by(name: name)
  17. next if !fetched_setting
  18. fetched_setting.options = fetched_setting.options.tap do |options|
  19. options[:form].first[:translate] = true
  20. end
  21. fetched_setting.save!
  22. end
  23. end
  24. end