20230129220648_taskbar_update_preference_tasks.rb 420 B

1234567891011121314
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class TaskbarUpdatePreferenceTasks < ActiveRecord::Migration[6.1]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Taskbar.in_batches.each_record do |elem|
  7. elem.preferences ||= {}
  8. elem.preferences[:tasks] = elem.send(:collect_related_tasks)
  9. elem.save!
  10. end
  11. end
  12. end