"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170113000002_slack_group_config_issue_587.rb" (25 Mar 2021, 569 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 "20170113000002_slack_group_config_issue_587.rb": 3.4.1_vs_3.5.0.

    1 class SlackGroupConfigIssue587 < 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: 'slack_config')
    8     return if !setting
    9 
   10     return if !setting.state_current['value']
   11     return if !setting.state_current['value']['items']
   12 
   13     config_item = setting.state_current['value']['items'].first
   14     return if !config_item
   15 
   16     return if !config_item.key?('group_id')
   17 
   18     config_item['group_ids'] = config_item.delete('group_id')
   19 
   20     setting.save!
   21   end
   22 end