mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +02:00
Pump papertrail version to 6.0.2
This commit is contained in:
parent
ad46e08f32
commit
a18f7b1605
12 changed files with 19 additions and 16 deletions
2
Gemfile
2
Gemfile
|
@ -14,7 +14,7 @@ gem 'pg', '1.2.2'
|
|||
# 1.8 is for Rails < 5.0
|
||||
gem 'ransack', '~> 1.8'
|
||||
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
|
||||
gem 'paper_trail', '~> 4.0'
|
||||
gem 'paper_trail', '~> 6.0'
|
||||
|
||||
# 0.7.3 is the latest for Rails 4.2, however, it is absent on Rubygems server
|
||||
# https://github.com/huacnlee/rails-settings-cached/issues/165
|
||||
|
|
|
@ -272,9 +272,8 @@ GEM
|
|||
nori (2.6.0)
|
||||
open4 (1.3.4)
|
||||
orm_adapter (0.5.0)
|
||||
paper_trail (4.2.0)
|
||||
activerecord (>= 3.0, < 6.0)
|
||||
activesupport (>= 3.0, < 6.0)
|
||||
paper_trail (6.0.2)
|
||||
activerecord (>= 4.0, < 5.2)
|
||||
request_store (~> 1.1)
|
||||
pdfkit (0.8.4.1)
|
||||
pg (1.2.2)
|
||||
|
@ -482,7 +481,7 @@ DEPENDENCIES
|
|||
minitest (~> 5.14)
|
||||
money-rails
|
||||
nokogiri
|
||||
paper_trail (~> 4.0)
|
||||
paper_trail (~> 6.0)
|
||||
pdfkit
|
||||
pg (= 1.2.2)
|
||||
pry (= 0.10.1)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
check_authorization unless: :devise_controller?
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
|
@ -32,4 +33,4 @@ class ApplicationController < ActionController::Base
|
|||
def available_languages
|
||||
{ en: 'English', et: 'Estonian' }.invert
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ module Epp
|
|||
class DomainsController < BaseController
|
||||
before_action :find_domain, only: %i[info renew update transfer delete]
|
||||
before_action :find_password, only: %i[info update transfer delete]
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
def info
|
||||
authorize! :info, @domain
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Epp
|
||||
class SessionsController < BaseController
|
||||
skip_authorization_check only: [:hello, :login, :logout]
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
def hello
|
||||
render_epp_response('greeting')
|
||||
|
|
|
@ -55,7 +55,7 @@ module Versions
|
|||
|
||||
module ClassMethods
|
||||
def all_versions_for(ids, time)
|
||||
ver_klass = paper_trail_version_class
|
||||
ver_klass = paper_trail.version_class
|
||||
from_history = ver_klass.where(item_id: ids.to_a).
|
||||
order(:item_id).
|
||||
preceding(time + 1, true).
|
||||
|
|
1
config/initializers/paper_trail.rb
Normal file
1
config/initializers/paper_trail.rb
Normal file
|
@ -0,0 +1 @@
|
|||
PaperTrail.config.track_associations = false
|
|
@ -25,7 +25,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_locking_a_domain_creates_a_version_record
|
||||
assert_difference '@domain.versions.count', 1 do
|
||||
assert_difference '@domain.versions.count', 2 do
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
headers: @auth_headers
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class ContactAuditLogTest < ActionDispatch::IntegrationTest
|
|||
contact = contacts(:john)
|
||||
|
||||
contact.legal_document_id = 1
|
||||
assert_difference 'contact.versions.count' do
|
||||
assert_difference 'contact.versions.count', 2 do
|
||||
contact.save!
|
||||
end
|
||||
|
||||
|
@ -13,4 +13,4 @@ class ContactAuditLogTest < ActionDispatch::IntegrationTest
|
|||
assert_equal ({ legal_documents: [1] }).with_indifferent_access,
|
||||
contact_version.children.with_indifferent_access
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class DomainAuditLogTest < ActionDispatch::IntegrationTest
|
|||
assert_equal registrant_id, domain.registrant_id
|
||||
domain.legal_document_id = legal_document_id
|
||||
|
||||
assert_difference 'domain.versions.count' do
|
||||
assert_difference 'domain.versions.count', 2 do
|
||||
domain.save!
|
||||
end
|
||||
|
||||
|
@ -26,4 +26,4 @@ class DomainAuditLogTest < ActionDispatch::IntegrationTest
|
|||
assert_equal [legal_document_id], domain_version.children['legal_documents']
|
||||
assert_equal [registrant_id], domain_version.children['registrant']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ class PaperTrailLearningTest < ActiveSupport::TestCase
|
|||
@record = Post.create!(title: 'any')
|
||||
|
||||
assert_difference -> { @record.versions.size } do
|
||||
@record.touch_with_version
|
||||
@record.paper_trail.touch_with_version
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
|||
duplicate_domain = prepare_duplicate_domain
|
||||
|
||||
PaperTrail.whodunnit = @user.id_role_username
|
||||
assert_difference 'duplicate_domain.versions.count', 1 do
|
||||
assert_difference 'duplicate_domain.versions.count', 2 do
|
||||
duplicate_domain.save!
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
|||
def test_assigns_updator_to_paper_trail_whodunnit
|
||||
PaperTrail.whodunnit = @user.id_role_username
|
||||
|
||||
assert_difference '@domain.versions.count', 1 do
|
||||
assert_difference '@domain.versions.count', 2 do
|
||||
@domain.apply_registry_lock
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue