Sha256: 5bfac30fa0821b31242ebdb80e747dc88bf40393e9c7804f25ccf45402d04c67

Contents?: true

Size: 883 Bytes

Versions: 45

Compression:

Stored size: 883 Bytes

Contents

# frozen_string_literal: true

class FixMeetingsRegistrationTerms < ActiveRecord::Migration[5.2]
  def up
    reset_column_information

    PaperTrail.request(enabled: false) do
      Decidim::Meetings::Meeting.find_each do |meeting|
        next if meeting.component.nil?
        # Only user-created meetings have this problem
        next if meeting.official?

        # Since user-created meetings have no way to override the `registration_terms` field
        # and it's supposed to use the component defaults,
        # we can safely override this.
        meeting.registration_terms = meeting.component.settings.default_registration_terms
        meeting.save!
      end
    end
    reset_column_information
  end

  def down; end

  def reset_column_information
    Decidim::Meetings::Meeting.reset_column_information
    Decidim::Component.reset_column_information
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.8 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.7 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.6 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.10 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.9 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.5 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.8 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.4 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.3 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.7 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.5 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.2 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.1 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.4 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.0 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.3 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.0.rc2 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.27.0.rc1 db/migrate/20201016065302_fix_meetings_registration_terms.rb
decidim-meetings-0.26.2 db/migrate/20201016065302_fix_meetings_registration_terms.rb