"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170116000002_fixed_typos_622.rb" (25 Mar 2021, 1286 Bytes) of package /linux/www/zammad-4.0.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "20170116000002_fixed_typos_622.rb": 3.4.1_vs_3.5.0.

    1 class FixedTypos622 < ActiveRecord::Migration[4.2]
    2   def up
    3 
    4     # return if it's a new setup
    5     return if !Setting.exists?(name: 'system_init_done')
    6 
    7     setting = Setting.find_by(name: 'ticket_define_email_from_seperator')
    8     return if !setting
    9 
   10     setting.name = 'ticket_define_email_from_separator'
   11     setting.options[:form][0][:name] = 'ticket_define_email_from_separator'
   12     setting.save!
   13 
   14     setting_map = {
   15       'password_min_size'                       => 'Password needs to have at least minimal size of characters.',
   16       'password_min_2_lower_2_upper_characters' => 'Password needs to contain 2 lower and 2 upper characters.',
   17       'password_need_digit'                     => 'Password needs to have at least one digit.',
   18       'ticket_subject_size'                     => 'Max size of the subject in an email reply.',
   19       'postmaster_follow_up_search_in'          => 'In default the follow-up check is done via the subject of an email. With this setting you can add more fields where the follow-up check is executed.',
   20     }
   21 
   22     setting_map.each do |key, description|
   23       local_setting = Setting.find_by(name: key)
   24       next if !local_setting
   25 
   26       local_setting.description = description
   27       local_setting.save!
   28     end
   29 
   30     Translation.sync
   31 
   32   end
   33 end