20170113000002_slack_group_config_issue_587.rb 646 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class SlackGroupConfigIssue587 < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. setting = Setting.find_by(name: 'slack_config')
  7. return if !setting
  8. return if !setting.state_current['value']
  9. return if !setting.state_current['value']['items']
  10. config_item = setting.state_current['value']['items'].first
  11. return if !config_item
  12. return if !config_item.key?('group_id')
  13. config_item['group_ids'] = config_item.delete('group_id')
  14. setting.save!
  15. end
  16. end