Merge pull request #1593 from internetee/upgrade-rails-to-6.0.3

Upgrade Rails from 5.2 to 6.0.3
This commit is contained in:
Timo Võhmar 2020-06-03 15:04:36 +03:00 committed by GitHub
commit 2ffe9629f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 272 additions and 112 deletions

View file

@ -1,5 +1,5 @@
class Action < ApplicationRecord
has_paper_trail class_name: 'ActionVersion'
has_paper_trail versions: { class_name: 'ActionVersion' }
belongs_to :user
belongs_to :contact
@ -16,4 +16,4 @@ class Action < ApplicationRecord
raise 'Action object is missing' unless contact
"contact_#{operation}".to_sym
end
end
end

View file

@ -7,7 +7,7 @@ module Concerns
def start_client_hold
log_prepare_client_hold
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
::Domain.force_delete_scheduled.each do |domain|
proceed_client_hold(domain: domain)

View file

@ -7,9 +7,10 @@ module Versions
attr_accessor :version_loader
if WITH_CHILDREN.include?(model_name.name)
has_paper_trail class_name: "#{model_name}Version", meta: { children: :children_log }
has_paper_trail versions: { class_name: "#{model_name}Version" },
meta: { children: :children_log }
else
has_paper_trail class_name: "#{model_name}Version"
has_paper_trail versions: { class_name: "#{model_name}Version" }
end
# add creator and updator
@ -18,12 +19,12 @@ module Versions
before_update :add_updator
def add_creator
self.creator_str = ::PaperTrail.whodunnit
self.creator_str = ::PaperTrail.request.whodunnit
true
end
def add_updator
self.updator_str = ::PaperTrail.whodunnit
self.updator_str = ::PaperTrail.request.whodunnit
true
end
@ -51,11 +52,11 @@ module Versions
# callbacks
def touch_domain_version
domain.paper_trail.try(:touch_with_version)
domain.try(:touch)
end
def touch_domains_version
domains.each { |domain| domain.paper_trail.touch_with_version }
domains.each(&:touch)
end
end

View file

@ -6,7 +6,7 @@ class DomainCron
def self.clean_expired_pendings
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
expire_at = Setting.expire_pending_confirmation.hours.ago
count = 0
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
@ -38,7 +38,7 @@ class DomainCron
end
def self.start_expire_period
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
domains = Domain.expired
marked = 0
real = 0
@ -64,7 +64,7 @@ class DomainCron
def self.start_redemption_grace_period
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
::PaperTrail.request.whodunnit = "cron - #{__method__}"
domains = Domain.outzone_candidates
marked = 0

View file

@ -58,7 +58,7 @@ class LegalDocument < ApplicationRecord
end
def add_creator
self.creator_str = ::PaperTrail.whodunnit
self.creator_str = ::PaperTrail.request.whodunnit
true
end

View file

@ -1,7 +1,7 @@
# Used in Registrant portal to collect registrant verifications
# Registrant postgres user can access this table directly.
class RegistrantVerification < ApplicationRecord
has_paper_trail class_name: 'RegistrantVerificationVersion'
has_paper_trail versions: { class_name: 'RegistrantVerificationVersion' }
# actions
CONFIRMED = 'confirmed'