mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Fix namespaces for Zeitwerk class loader
This commit is contained in:
parent
32634c7a8b
commit
43b3033991
78 changed files with 666 additions and 704 deletions
|
@ -31,6 +31,9 @@ plugins:
|
||||||
rubocop:
|
rubocop:
|
||||||
enabled: true
|
enabled: true
|
||||||
channel: rubocop-0-74
|
channel: rubocop-0-74
|
||||||
|
checks:
|
||||||
|
Rubocop/Style/ClassAndModuleChildren:
|
||||||
|
enabled: false
|
||||||
checks:
|
checks:
|
||||||
method-lines:
|
method-lines:
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -2,12 +2,12 @@ module Admin
|
||||||
class ContactVersionsController < BaseController
|
class ContactVersionsController < BaseController
|
||||||
include ObjectVersionsHelper
|
include ObjectVersionsHelper
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource class: Version::ContactVersion
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
@q = ContactVersion.search(params[:q])
|
@q = Version::ContactVersion.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
versions = Version::ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
||||||
@q = versions.search(params[:q])
|
@q = versions.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
|
@ -32,8 +32,8 @@ module Admin
|
||||||
|
|
||||||
def show
|
def show
|
||||||
per_page = 7
|
per_page = 7
|
||||||
@version = ContactVersion.find(params[:id])
|
@version = Version::ContactVersion.find(params[:id])
|
||||||
@versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
@versions = Version::ContactVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
||||||
@versions_map = @versions.all.map(&:id)
|
@versions_map = @versions.all.map(&:id)
|
||||||
|
|
||||||
# what we do is calc amount of results until needed version
|
# what we do is calc amount of results until needed version
|
||||||
|
@ -49,7 +49,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
render json: ContactVersion.search_by_query(params[:q])
|
render json: Version::ContactVersion.search_by_query(params[:q])
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_where_string(key, value)
|
def create_where_string(key, value)
|
||||||
|
|
|
@ -2,12 +2,12 @@ module Admin
|
||||||
class DomainVersionsController < BaseController
|
class DomainVersionsController < BaseController
|
||||||
include ObjectVersionsHelper
|
include ObjectVersionsHelper
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource class: Version::DomainVersion
|
||||||
|
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
|
|
||||||
@q = DomainVersion.includes(:item).search(params[:q])
|
@q = Version::DomainVersion.includes(:item).search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
search_params = params[:q].deep_dup
|
search_params = params[:q].deep_dup
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ module Admin
|
||||||
whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present?
|
whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present?
|
||||||
whereS += " AND 1=0" if registrars == []
|
whereS += " AND 1=0" if registrars == []
|
||||||
|
|
||||||
versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
versions = Version::DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc)
|
||||||
@q = versions.search(params[:q])
|
@q = versions.search(params[:q])
|
||||||
@versions = @q.result.page(params[:page])
|
@versions = @q.result.page(params[:page])
|
||||||
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
@versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||||
|
@ -50,8 +50,8 @@ module Admin
|
||||||
|
|
||||||
def show
|
def show
|
||||||
per_page = 7
|
per_page = 7
|
||||||
@version = DomainVersion.find(params[:id])
|
@version = Version::DomainVersion.find(params[:id])
|
||||||
@versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
@versions = Version::DomainVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc)
|
||||||
@versions_map = @versions.all.map(&:id)
|
@versions_map = @versions.all.map(&:id)
|
||||||
|
|
||||||
# what we do is calc amount of results until needed version
|
# what we do is calc amount of results until needed version
|
||||||
|
@ -67,7 +67,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
render json: DomainVersion.search_by_query(params[:q])
|
render json: Version::DomainVersion.search_by_query(params[:q])
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_where_string(key, value)
|
def create_where_string(key, value)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Registrar
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_ip_restriction
|
def check_ip_restriction
|
||||||
ip_restriction = Authorization::RestrictedIP.new(request.ip)
|
ip_restriction = Authorization::RestrictedIp.new(request.ip)
|
||||||
allowed = ip_restriction.can_access_registrar_area?(current_registrar_user.registrar)
|
allowed = ip_restriction.can_access_registrar_area?(current_registrar_user.registrar)
|
||||||
|
|
||||||
return if allowed
|
return if allowed
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Registrar
|
||||||
domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context)
|
domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context)
|
||||||
end
|
end
|
||||||
|
|
||||||
raw_csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters,
|
raw_csv = Registrar::DomainListCsvPresenter.new(domains: domain_presenters,
|
||||||
view: view_context).to_s
|
view: view_context).to_s
|
||||||
filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv"
|
filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv"
|
||||||
send_data raw_csv, filename: filename, type: "#{Mime[:csv]}; charset=utf-8"
|
send_data raw_csv, filename: filename, type: "#{Mime[:csv]}; charset=utf-8"
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_ip_restriction
|
def check_ip_restriction
|
||||||
ip_restriction = Authorization::RestrictedIP.new(request.ip)
|
ip_restriction = Authorization::RestrictedIp.new(request.ip)
|
||||||
allowed = ip_restriction.can_access_registrar_area_sign_in_page?
|
allowed = ip_restriction.can_access_registrar_area_sign_in_page?
|
||||||
|
|
||||||
return if allowed
|
return if allowed
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class PunycodeInterceptor
|
class Interceptors::PunycodeInterceptor
|
||||||
class << self
|
class << self
|
||||||
def delivering_email(message)
|
def delivering_email(message)
|
||||||
message.from = encode_addresses_as_punycode(message.from)
|
message.from = encode_addresses_as_punycode(message.from)
|
||||||
|
|
|
@ -89,8 +89,8 @@ class Ability
|
||||||
can :manage, BlockedDomain
|
can :manage, BlockedDomain
|
||||||
can :manage, ReservedDomain
|
can :manage, ReservedDomain
|
||||||
can :manage, DNS::Zone
|
can :manage, DNS::Zone
|
||||||
can :manage, DomainVersion
|
can :manage, Version::DomainVersion
|
||||||
can :manage, ContactVersion
|
can :manage, Version::ContactVersion
|
||||||
can :manage, Billing::Price
|
can :manage, Billing::Price
|
||||||
can :manage, User
|
can :manage, User
|
||||||
can :manage, ApiUser
|
can :manage, ApiUser
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Action < ApplicationRecord
|
class Action < ApplicationRecord
|
||||||
has_paper_trail versions: { class_name: 'ActionVersion' }
|
has_paper_trail versions: { class_name: 'Version::ActionVersion' }
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :contact
|
belongs_to :contact
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Authorization
|
module Authorization
|
||||||
class RestrictedIP
|
class RestrictedIp
|
||||||
def initialize(ip)
|
def initialize(ip)
|
||||||
@ip = ip
|
@ip = ip
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Billing
|
module Billing
|
||||||
class Price < ApplicationRecord
|
class Price < ApplicationRecord
|
||||||
include Concerns::Billing::Price::Expirable
|
include Billing::Price::Expirable
|
||||||
include Versions
|
include Versions
|
||||||
|
|
||||||
belongs_to :zone, class_name: 'DNS::Zone', required: true
|
belongs_to :zone, class_name: 'DNS::Zone', required: true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Billing::Price::Expirable
|
module Billing::Price::Expirable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Contact::Archivable
|
||||||
module Contact
|
|
||||||
module Archivable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
@ -37,11 +35,11 @@ module Concerns
|
||||||
end
|
end
|
||||||
|
|
||||||
def inactive?
|
def inactive?
|
||||||
if DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
if Version::DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
DomainVersion.was_contact_linked?(id) ? false : created_at <= inactivity_period.ago
|
Version::DomainVersion.was_contact_linked?(id) ? false : created_at <= inactivity_period.ago
|
||||||
end
|
end
|
||||||
|
|
||||||
def inactivity_period
|
def inactivity_period
|
||||||
|
@ -63,6 +61,4 @@ module Concerns
|
||||||
f.write("#{code}\n")
|
f.write("#{code}\n")
|
||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Contact::Disclosable
|
||||||
module Contact
|
|
||||||
module Disclosable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
@ -21,6 +19,4 @@ module Concerns
|
||||||
.any?
|
.any?
|
||||||
errors.add(:disclosed_attributes, :invalid) if has_undisclosable_attributes
|
errors.add(:disclosed_attributes, :invalid) if has_undisclosable_attributes
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Contact::Identical
|
module Contact::Identical
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
IDENTIFIABLE_ATTRIBUTES = %w[
|
IDENTIFIABLE_ATTRIBUTES = %w[
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::Activatable
|
module Domain::Activatable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def active?
|
def active?
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Domain::BulkUpdatable
|
||||||
module Domain
|
|
||||||
module BulkUpdatable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def bulk_update_prohibited?
|
def bulk_update_prohibited?
|
||||||
|
@ -12,6 +10,4 @@ module Concerns
|
||||||
DomainStatus::CLIENT_UPDATE_PROHIBITED]
|
DomainStatus::CLIENT_UPDATE_PROHIBITED]
|
||||||
prohibited_array.any? { |block_status| statuses.include?(block_status) }
|
prohibited_array.any? { |block_status| statuses.include?(block_status) }
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::Deletable
|
module Domain::Deletable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
DELETE_STATUSES = [
|
DELETE_STATUSES = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::Discardable
|
module Domain::Discardable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def keep
|
def keep
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Concerns
|
module Domain::Disputable
|
||||||
module Domain
|
|
||||||
module Disputable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
@ -39,6 +37,4 @@ module Concerns
|
||||||
|
|
||||||
errors.add(:base, :invalid_auth_information_reserved)
|
errors.add(:base, :invalid_auth_information_reserved)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::Expirable
|
module Domain::Expirable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
module Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Domain::RegistryLockable
|
||||||
module Domain
|
|
||||||
module RegistryLockable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def apply_registry_lock
|
def apply_registry_lock
|
||||||
|
@ -58,6 +56,4 @@ module Concerns
|
||||||
attached_obj_type: self.class.name
|
attached_obj_type: self.class.name
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Domain::Releasable
|
||||||
module Domain
|
|
||||||
module Releasable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
@ -52,6 +50,4 @@ module Concerns
|
||||||
discard
|
discard
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Domain::Transferable
|
module Domain::Transferable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
module Concerns
|
module EmailVerifable
|
||||||
module EmailVerifable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def email_verification
|
def email_verification
|
||||||
|
@ -91,5 +90,4 @@ module Concerns
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/LineLength
|
# rubocop:enable Metrics/LineLength
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Invoice::BookKeeping
|
||||||
module Invoice
|
|
||||||
module BookKeeping
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def as_directo_json
|
def as_directo_json
|
||||||
|
@ -29,6 +27,4 @@ module Concerns
|
||||||
'vat_reg_no': buyer_vat_no,
|
'vat_reg_no': buyer_vat_no,
|
||||||
}.as_json
|
}.as_json
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Invoice::Cancellable
|
||||||
module Invoice
|
|
||||||
module Cancellable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
@ -23,6 +21,4 @@ module Concerns
|
||||||
def not_cancelled?
|
def not_cancelled?
|
||||||
!cancelled?
|
!cancelled?
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Invoice::Payable
|
||||||
module Invoice
|
|
||||||
module Payable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
@ -23,6 +21,4 @@ module Concerns
|
||||||
def unpaid?
|
def unpaid?
|
||||||
!paid?
|
!paid?
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Registrar::BookKeeping
|
||||||
module Registrar
|
|
||||||
module BookKeeping
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
DOMAIN_TO_PRODUCT = { 'ee': '01EE', 'com.ee': '02COM', 'pri.ee': '03PRI',
|
DOMAIN_TO_PRODUCT = { 'ee': '01EE', 'com.ee': '02COM', 'pri.ee': '03PRI',
|
||||||
|
@ -123,6 +121,4 @@ module Concerns
|
||||||
|
|
||||||
@pricelists[account_activity.price_id] = account_activity.price
|
@pricelists[account_activity.price_id] = account_activity.price
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Registrar::LegalDoc
|
||||||
module Registrar
|
|
||||||
module LegalDoc
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def legaldoc_mandatory?
|
def legaldoc_mandatory?
|
||||||
|
@ -11,6 +9,4 @@ module Concerns
|
||||||
setting = Setting.legal_document_is_mandatory
|
setting = Setting.legal_document_is_mandatory
|
||||||
legaldoc_optout || !setting
|
legaldoc_optout || !setting
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,10 +7,10 @@ module Versions
|
||||||
attr_accessor :version_loader
|
attr_accessor :version_loader
|
||||||
|
|
||||||
if WITH_CHILDREN.include?(model_name.name)
|
if WITH_CHILDREN.include?(model_name.name)
|
||||||
has_paper_trail versions: { class_name: "#{model_name}Version" },
|
has_paper_trail versions: { class_name: "Version::#{model_name}Version" },
|
||||||
meta: { children: :children_log }
|
meta: { children: :children_log }
|
||||||
else
|
else
|
||||||
has_paper_trail versions: { class_name: "#{model_name}Version" }
|
has_paper_trail versions: { class_name: "Version::#{model_name}Version" }
|
||||||
end
|
end
|
||||||
|
|
||||||
# add creator and updator
|
# add creator and updator
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
module Concerns
|
module Zone::WhoisQueryable
|
||||||
module Zone
|
|
||||||
module WhoisQueryable
|
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
@ -69,6 +67,4 @@ module Concerns
|
||||||
|
|
||||||
vars
|
vars
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,11 +4,11 @@ class Contact < ApplicationRecord
|
||||||
include Versions # version/contact_version.rb
|
include Versions # version/contact_version.rb
|
||||||
include EppErrors
|
include EppErrors
|
||||||
include UserEvents
|
include UserEvents
|
||||||
include Concerns::Contact::Transferable
|
include Contact::Transferable
|
||||||
include Concerns::Contact::Identical
|
include Contact::Identical
|
||||||
include Concerns::Contact::Disclosable
|
include Contact::Disclosable
|
||||||
include Concerns::Contact::Archivable
|
include Contact::Archivable
|
||||||
include Concerns::EmailVerifable
|
include EmailVerifable
|
||||||
|
|
||||||
belongs_to :original, class_name: self.name
|
belongs_to :original, class_name: self.name
|
||||||
belongs_to :registrar, required: true
|
belongs_to :registrar, required: true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Concerns::Contact::Transferable
|
module Contact::Transferable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
@ -9,7 +9,7 @@ module Concerns::Contact::Transferable
|
||||||
def transfer(new_registrar)
|
def transfer(new_registrar)
|
||||||
return identical(new_registrar) if identical(new_registrar)
|
return identical(new_registrar) if identical(new_registrar)
|
||||||
|
|
||||||
new_contact = self.dup
|
new_contact = dup
|
||||||
new_contact.registrar = new_registrar
|
new_contact.registrar = new_registrar
|
||||||
new_contact.original = self
|
new_contact.original = self
|
||||||
new_contact.code = nil
|
new_contact.code = nil
|
|
@ -5,7 +5,7 @@ module DNS
|
||||||
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
|
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
|
||||||
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
|
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
|
||||||
validates :origin, uniqueness: true
|
validates :origin, uniqueness: true
|
||||||
include Concerns::Zone::WhoisQueryable
|
include ::Zone::WhoisQueryable
|
||||||
|
|
||||||
before_destroy do
|
before_destroy do
|
||||||
throw(:abort) if used?
|
throw(:abort) if used?
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
class Domain < ApplicationRecord
|
class Domain < ApplicationRecord
|
||||||
include UserEvents
|
include UserEvents
|
||||||
include Versions # version/domain_version.rb
|
include Versions # version/domain_version.rb
|
||||||
include Concerns::Domain::Expirable
|
include Domain::Expirable
|
||||||
include Concerns::Domain::Activatable
|
include Domain::Activatable
|
||||||
include Concerns::Domain::ForceDelete
|
include Domain::ForceDelete
|
||||||
include Concerns::Domain::Discardable
|
include Domain::Discardable
|
||||||
include Concerns::Domain::Deletable
|
include Domain::Deletable
|
||||||
include Concerns::Domain::Transferable
|
include Domain::Transferable
|
||||||
include Concerns::Domain::RegistryLockable
|
include Domain::RegistryLockable
|
||||||
include Concerns::Domain::Releasable
|
include Domain::Releasable
|
||||||
include Concerns::Domain::Disputable
|
include Domain::Disputable
|
||||||
include Concerns::Domain::BulkUpdatable
|
include Domain::BulkUpdatable
|
||||||
|
|
||||||
attr_accessor :roles
|
attr_accessor :roles
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Invoice < ApplicationRecord
|
class Invoice < ApplicationRecord
|
||||||
include Versions
|
include Versions
|
||||||
include Concerns::Invoice::Cancellable
|
include Invoice::Cancellable
|
||||||
include Concerns::Invoice::Payable
|
include Invoice::Payable
|
||||||
include Concerns::Invoice::BookKeeping
|
include Invoice::BookKeeping
|
||||||
|
|
||||||
belongs_to :buyer, class_name: 'Registrar'
|
belongs_to :buyer, class_name: 'Registrar'
|
||||||
has_one :account_activity
|
has_one :account_activity
|
||||||
|
@ -34,7 +34,7 @@ class Invoice < ApplicationRecord
|
||||||
before_create :calculate_total, unless: :total?
|
before_create :calculate_total, unless: :total?
|
||||||
before_create :apply_default_buyer_vat_no, unless: :buyer_vat_no?
|
before_create :apply_default_buyer_vat_no, unless: :buyer_vat_no?
|
||||||
|
|
||||||
attribute :vat_rate, ::Type::VATRate.new
|
attribute :vat_rate, ::Type::VatRate.new
|
||||||
|
|
||||||
def set_invoice_number
|
def set_invoice_number
|
||||||
last_no = Invoice.order(number: :desc).limit(1).pluck(:number).first
|
last_no = Invoice.order(number: :desc).limit(1).pluck(:number).first
|
||||||
|
|
|
@ -82,7 +82,7 @@ class LegalDocument < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
contact_ids = DomainVersion.where(item_id: orig_legal.documentable_id).distinct.
|
contact_ids = Version::DomainVersion.where(item_id: orig_legal.documentable_id).distinct.
|
||||||
pluck("object->>'registrant_id'", "object_changes->>'registrant_id'",
|
pluck("object->>'registrant_id'", "object_changes->>'registrant_id'",
|
||||||
"children->>'tech_contacts'", "children->>'admin_contacts'").flatten.uniq
|
"children->>'tech_contacts'", "children->>'admin_contacts'").flatten.uniq
|
||||||
contact_ids = contact_ids.map{|id|
|
contact_ids = contact_ids.map{|id|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Registrar < ApplicationRecord
|
class Registrar < ApplicationRecord
|
||||||
include Versions # version/registrar_version.rb
|
include Versions # version/registrar_version.rb
|
||||||
include Concerns::Registrar::BookKeeping
|
include Registrar::BookKeeping
|
||||||
include Concerns::EmailVerifable
|
include EmailVerifable
|
||||||
include Concerns::Registrar::LegalDoc
|
include Registrar::LegalDoc
|
||||||
|
|
||||||
has_many :domains, dependent: :restrict_with_error
|
has_many :domains, dependent: :restrict_with_error
|
||||||
has_many :contacts, dependent: :restrict_with_error
|
has_many :contacts, dependent: :restrict_with_error
|
||||||
|
@ -30,7 +30,7 @@ class Registrar < ApplicationRecord
|
||||||
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than: 100 },
|
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than: 100 },
|
||||||
allow_nil: true
|
allow_nil: true
|
||||||
|
|
||||||
attribute :vat_rate, ::Type::VATRate.new
|
attribute :vat_rate, ::Type::VatRate.new
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
|
|
||||||
validate :correct_email_format, if: proc { |c| c.will_save_change_to_email? }
|
validate :correct_email_format, if: proc { |c| c.will_save_change_to_email? }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Type
|
module Type
|
||||||
class VATRate < ActiveRecord::Type::Decimal
|
class VatRate < ActiveRecord::Type::Decimal
|
||||||
def deserialize(value)
|
def deserialize(value)
|
||||||
super * 100 if value
|
super * 100 if value
|
||||||
end
|
end
|
||||||
|
|
1
app/models/version.rb
Normal file
1
app/models/version.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
class Version; end
|
|
@ -1,4 +1,4 @@
|
||||||
class AccountActivityVersion < PaperTrail::Version
|
class Version::AccountActivityVersion < PaperTrail::Version
|
||||||
self.table_name = :log_account_activities
|
self.table_name = :log_account_activities
|
||||||
self.sequence_name = :log_account_activities_id_seq
|
self.sequence_name = :log_account_activities_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class AccountVersion < PaperTrail::Version
|
class Version::AccountVersion < PaperTrail::Version
|
||||||
self.table_name = :log_accounts
|
self.table_name = :log_accounts
|
||||||
self.sequence_name = :log_accounts_id_seq
|
self.sequence_name = :log_accounts_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ActionVersion < PaperTrail::Version
|
class Version::ActionVersion < PaperTrail::Version
|
||||||
self.table_name = :log_actions
|
self.table_name = :log_actions
|
||||||
self.sequence_name = :log_actions_id_seq
|
self.sequence_name = :log_actions_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BankStatementVersion < PaperTrail::Version
|
class Version::BankStatementVersion < PaperTrail::Version
|
||||||
self.table_name = :log_bank_statements
|
self.table_name = :log_bank_statements
|
||||||
self.sequence_name = :log_bank_statements_id_seq
|
self.sequence_name = :log_bank_statements_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BankTransactionVersion < PaperTrail::Version
|
class Version::BankTransactionVersion < PaperTrail::Version
|
||||||
self.table_name = :log_bank_transactions
|
self.table_name = :log_bank_transactions
|
||||||
self.sequence_name = :log_bank_transactions_id_seq
|
self.sequence_name = :log_bank_transactions_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
module Billing
|
class Version::Billing::PriceVersion < PaperTrail::Version
|
||||||
class PriceVersion < PaperTrail::Version
|
|
||||||
self.table_name = :log_prices
|
self.table_name = :log_prices
|
||||||
self.sequence_name = :log_prices_id_seq
|
self.sequence_name = :log_prices_id_seq
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BlockedDomainVersion < PaperTrail::Version
|
class Version::BlockedDomainVersion < PaperTrail::Version
|
||||||
self.table_name = :log_blocked_domains
|
self.table_name = :log_blocked_domains
|
||||||
self.sequence_name = :log_blocked_domains_id_seq
|
self.sequence_name = :log_blocked_domains_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class CertificateVersion < PaperTrail::Version
|
class Version::CertificateVersion < PaperTrail::Version
|
||||||
self.table_name = :log_certificates
|
self.table_name = :log_certificates
|
||||||
self.sequence_name = :log_certificates_id_seq
|
self.sequence_name = :log_certificates_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ContactVersion < PaperTrail::Version
|
class Version::ContactVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_contacts
|
self.table_name = :log_contacts
|
||||||
self.sequence_name = :log_contacts_id_seq
|
self.sequence_name = :log_contacts_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DnskeyVersion < PaperTrail::Version
|
class Version::DnskeyVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_dnskeys
|
self.table_name = :log_dnskeys
|
||||||
self.sequence_name = :log_dnskeys_id_seq
|
self.sequence_name = :log_dnskeys_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DomainContactVersion < PaperTrail::Version
|
class Version::DomainContactVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_domain_contacts
|
self.table_name = :log_domain_contacts
|
||||||
self.sequence_name = :log_domain_contacts_id_seq
|
self.sequence_name = :log_domain_contacts_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DomainVersion < PaperTrail::Version
|
class Version::DomainVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
|
|
||||||
self.table_name = :log_domains
|
self.table_name = :log_domains
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class InvoiceItemVersion < PaperTrail::Version
|
class Version::InvoiceItemVersion < PaperTrail::Version
|
||||||
self.table_name = :log_invoice_items
|
self.table_name = :log_invoice_items
|
||||||
self.sequence_name = :log_invoice_items_id_seq
|
self.sequence_name = :log_invoice_items_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class InvoiceVersion < PaperTrail::Version
|
class Version::InvoiceVersion < PaperTrail::Version
|
||||||
self.table_name = :log_invoices
|
self.table_name = :log_invoices
|
||||||
self.sequence_name = :log_invoices_id_seq
|
self.sequence_name = :log_invoices_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class NameserverVersion < PaperTrail::Version
|
class Version::NameserverVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_nameservers
|
self.table_name = :log_nameservers
|
||||||
self.sequence_name = :log_nameservers_id_seq
|
self.sequence_name = :log_nameservers_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class NotificationVersion < PaperTrail::Version
|
class Version::NotificationVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_notifications
|
self.table_name = :log_notifications
|
||||||
self.sequence_name = :log_notifications_id_seq
|
self.sequence_name = :log_notifications_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class PaymentOrderVersion < PaperTrail::Version
|
class Version::PaymentOrderVersion < PaperTrail::Version
|
||||||
self.table_name = :log_payment_orders
|
self.table_name = :log_payment_orders
|
||||||
self.sequence_name = :log_payment_orders_id_seq
|
self.sequence_name = :log_payment_orders_id_seq
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class RegistrantVerificationVersion < PaperTrail::Version
|
class Version::RegistrantVerificationVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_registrant_verifications
|
self.table_name = :log_registrant_verifications
|
||||||
self.sequence_name = :log_registrant_verifications_id_seq
|
self.sequence_name = :log_registrant_verifications_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class RegistrarVersion < PaperTrail::Version
|
class Version::RegistrarVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_registrars
|
self.table_name = :log_registrars
|
||||||
self.sequence_name = :log_registrars_id_seq
|
self.sequence_name = :log_registrars_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class ReservedDomainVersion < PaperTrail::Version
|
class Version::ReservedDomainVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_reserved_domains
|
self.table_name = :log_reserved_domains
|
||||||
self.sequence_name = :log_reserved_domains_id_seq
|
self.sequence_name = :log_reserved_domains_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class SettingEntryVersion < PaperTrail::Version
|
class Version::SettingEntryVersion < PaperTrail::Version
|
||||||
self.table_name = :log_setting_entries
|
self.table_name = :log_setting_entries
|
||||||
self.sequence_name = :log_setting_entries
|
self.sequence_name = :log_setting_entries
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class SettingVersion < PaperTrail::Version
|
class Version::SettingVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_settings
|
self.table_name = :log_settings
|
||||||
self.sequence_name = :log_settings_id_seq
|
self.sequence_name = :log_settings_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class UserVersion < PaperTrail::Version
|
class Version::UserVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_users
|
self.table_name = :log_users
|
||||||
self.sequence_name = :log_users_id_seq
|
self.sequence_name = :log_users_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class WhiteIpVersion < PaperTrail::Version
|
class Version::WhiteIpVersion < PaperTrail::Version
|
||||||
include VersionSession
|
include VersionSession
|
||||||
self.table_name = :log_white_ips
|
self.table_name = :log_white_ips
|
||||||
self.sequence_name = :log_white_ips_id_seq
|
self.sequence_name = :log_white_ips_id_seq
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Registrar::DomainListCSVPresenter
|
class Registrar::DomainListCsvPresenter
|
||||||
def initialize(domains:, view:)
|
def initialize(domains:, view:)
|
||||||
@domains = domains
|
@domains = domains
|
||||||
@view = view
|
@view = view
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
= domain.registrant.name
|
= domain.registrant.name
|
||||||
- else
|
- else
|
||||||
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
|
- contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first
|
||||||
- if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last
|
- if contact.nil? && ver = Version::ContactVersion.where(item_id: domain.registrant_id).last
|
||||||
- contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last }))
|
- contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}) {|(k,v), o| o[k] = v.last }))
|
||||||
= contact.try(:name)
|
= contact.try(:name)
|
||||||
= " ".html_safe
|
= " ".html_safe
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
- admin_contacts = domain.admin_contacts
|
- admin_contacts = domain.admin_contacts
|
||||||
- registrant = domain.registrant
|
- registrant = domain.registrant
|
||||||
- unless registrant
|
- unless registrant
|
||||||
- ver = ContactVersion.where(item_id: domain.registrant_id).where(event: :destroy).last
|
- ver = Version::ContactVersion.where(item_id: domain.registrant_id).where(event: :destroy).last
|
||||||
- registrant = ver.reify
|
- registrant = ver.reify
|
||||||
- registrant.version_loader = ver
|
- registrant.version_loader = ver
|
||||||
- registrant = [registrant]
|
- registrant = [registrant]
|
||||||
|
|
|
@ -17,7 +17,7 @@ end
|
||||||
module DomainNameRegistry
|
module DomainNameRegistry
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
config.load_defaults 6.0
|
config.load_defaults 6.0
|
||||||
config.autoloader = :classic # Do not use zeitwerk for now
|
config.autoloader = :zeitwerk # Do not use zeitwerk for now
|
||||||
|
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
|
@ -35,9 +35,9 @@ module DomainNameRegistry
|
||||||
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
||||||
|
|
||||||
# Autoload all model subdirs
|
# Autoload all model subdirs
|
||||||
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
|
# config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
|
||||||
config.autoload_paths += Dir[Rails.root.join('app', 'lib', '**/')]
|
# config.autoload_paths += Dir[Rails.root.join('app', 'lib', '**/')]
|
||||||
config.autoload_paths += Dir[Rails.root.join('app', 'interactions', '**/')]
|
# config.autoload_paths += Dir[Rails.root.join('app', 'interactions', '**/')]
|
||||||
config.eager_load_paths << config.root.join('lib', 'validators')
|
config.eager_load_paths << config.root.join('lib', 'validators')
|
||||||
config.eager_load_paths << config.root.join('app', 'lib')
|
config.eager_load_paths << config.root.join('app', 'lib')
|
||||||
config.watchable_dirs['lib'] = %i[rb]
|
config.watchable_dirs['lib'] = %i[rb]
|
||||||
|
@ -72,8 +72,7 @@ module DomainNameRegistry
|
||||||
}
|
}
|
||||||
config.action_mailer.default_options = { from: ENV['action_mailer_default_from'] }
|
config.action_mailer.default_options = { from: ENV['action_mailer_default_from'] }
|
||||||
|
|
||||||
require "#{Rails.root}/app/mailers/interceptors/punycode_interceptor"
|
config.action_mailer.interceptors = ["Interceptors::PunycodeInterceptor"]
|
||||||
ActionMailer::Base.register_interceptor(PunycodeInterceptor)
|
|
||||||
|
|
||||||
config.action_view.default_form_builder = 'DefaultFormBuilder'
|
config.action_view.default_form_builder = 'DefaultFormBuilder'
|
||||||
config.secret_key_base = Figaro.env.secret_key_base
|
config.secret_key_base = Figaro.env.secret_key_base
|
||||||
|
|
|
@ -247,12 +247,24 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :version_domain_versions do
|
||||||
|
collection do
|
||||||
|
get 'search' => 'domain_versions#search', via: [:get, :post], as: :search
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :contact_versions do
|
resources :contact_versions do
|
||||||
collection do
|
collection do
|
||||||
get 'search'
|
get 'search'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :version_contact_versions do
|
||||||
|
collection do
|
||||||
|
get 'search' => 'contact_versions#search', via: [:get, :post], as: :search
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :settings, only: %i[index create]
|
resources :settings, only: %i[index create]
|
||||||
|
|
||||||
resources :blocked_domains do
|
resources :blocked_domains do
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace :documents do
|
||||||
next if x.documentable_id.blank?
|
next if x.documentable_id.blank?
|
||||||
|
|
||||||
document_type = case x.documentable_type
|
document_type = case x.documentable_type
|
||||||
when 'Domain' then DomainVersion
|
when 'Domain' then Version::DomainVersion
|
||||||
when 'Contact'then ContactVersion
|
when 'Contact'then Version::ContactVersion
|
||||||
end
|
end
|
||||||
|
|
||||||
dc = document_type.where(item_id: x.documentable_id)
|
dc = document_type.where(item_id: x.documentable_id)
|
||||||
|
|
|
@ -7,7 +7,7 @@ class VersionsTest < ActiveSupport::TestCase
|
||||||
@nameserver.update(hostname: 'ns99.bestnames.test')
|
@nameserver.update(hostname: 'ns99.bestnames.test')
|
||||||
@ignored_column_title = Nameserver.ignored_columns.first
|
@ignored_column_title = Nameserver.ignored_columns.first
|
||||||
|
|
||||||
version = NameserverVersion.last
|
version = Version::NameserverVersion.last
|
||||||
hash = version.object
|
hash = version.object
|
||||||
hash[@ignored_column_title] = 123456
|
hash[@ignored_column_title] = 123456
|
||||||
version.update(object: hash)
|
version.update(object: hash)
|
||||||
|
|
|
@ -6,8 +6,8 @@ class ArchivableContactTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_is_archivable_when_it_was_linked_and_inactivity_period_has_passed
|
def test_contact_is_archivable_when_it_was_linked_and_inactivity_period_has_passed
|
||||||
DomainVersion.stub(:was_contact_linked?, true) do
|
Version::DomainVersion.stub(:was_contact_linked?, true) do
|
||||||
DomainVersion.stub(:contact_unlinked_more_than?, true) do
|
Version::DomainVersion.stub(:contact_unlinked_more_than?, true) do
|
||||||
assert @contact.archivable?
|
assert @contact.archivable?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@ class ArchivableContactTest < ActiveSupport::TestCase
|
||||||
@contact.created_at = Time.zone.parse('2010-07-05 00:00:00')
|
@contact.created_at = Time.zone.parse('2010-07-05 00:00:00')
|
||||||
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
||||||
|
|
||||||
DomainVersion.stub(:was_contact_linked?, false) do
|
Version::DomainVersion.stub(:was_contact_linked?, false) do
|
||||||
assert @contact.archivable?
|
assert @contact.archivable?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,14 +28,14 @@ class ArchivableContactTest < ActiveSupport::TestCase
|
||||||
@contact.created_at = Time.zone.parse('2010-07-05')
|
@contact.created_at = Time.zone.parse('2010-07-05')
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
DomainVersion.stub(:contact_unlinked_more_than?, false) do
|
Version::DomainVersion.stub(:contact_unlinked_more_than?, false) do
|
||||||
assert_not @contact.archivable?
|
assert_not @contact.archivable?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_is_not_archivable_when_it_was_ever_linked_but_linked_within_inactivity_period
|
def test_contact_is_not_archivable_when_it_was_ever_linked_but_linked_within_inactivity_period
|
||||||
DomainVersion.stub(:was_contact_linked?, true) do
|
Version::DomainVersion.stub(:was_contact_linked?, true) do
|
||||||
DomainVersion.stub(:contact_unlinked_more_than?, false) do
|
Version::DomainVersion.stub(:contact_unlinked_more_than?, false) do
|
||||||
assert_not @contact.archivable?
|
assert_not @contact.archivable?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -73,7 +73,7 @@ class ArchivableContactTest < ActiveSupport::TestCase
|
||||||
def archivable_contact
|
def archivable_contact
|
||||||
contact = contacts(:john)
|
contact = contacts(:john)
|
||||||
Setting.orphans_contacts_in_months = 0
|
Setting.orphans_contacts_in_months = 0
|
||||||
DomainVersion.delete_all
|
Version::DomainVersion.delete_all
|
||||||
|
|
||||||
other_contact = contacts(:william)
|
other_contact = contacts(:william)
|
||||||
assert_not_equal other_contact, contact
|
assert_not_equal other_contact, contact
|
||||||
|
|
|
@ -15,7 +15,7 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
|
||||||
registrant_verification = registrant_verifications(:one)
|
registrant_verification = registrant_verifications(:one)
|
||||||
random_action = "random#{rand(100)}"
|
random_action = "random#{rand(100)}"
|
||||||
|
|
||||||
assert_difference -> { RegistrantVerificationVersion.count } do
|
assert_difference -> { Version::RegistrantVerificationVersion.count } do
|
||||||
registrant_verification.update_attributes!(action: random_action)
|
registrant_verification.update_attributes!(action: random_action)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,11 +23,11 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
|
||||||
def test_reject_changes
|
def test_reject_changes
|
||||||
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
|
||||||
verification_token: @token)
|
verification_token: @token)
|
||||||
start_versions_count = RegistrantVerificationVersion.count
|
start_versions_count = Version::RegistrantVerificationVersion.count
|
||||||
|
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
@registrant_verification.domain_registrant_change_reject!("email link, #{@initiator}")
|
@registrant_verification.domain_registrant_change_reject!("email link, #{@initiator}")
|
||||||
end
|
end
|
||||||
assert_equal RegistrantVerificationVersion.count, start_versions_count + 1
|
assert_equal Version::RegistrantVerificationVersion.count, start_versions_count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
tech_contacts: [],
|
tech_contacts: [],
|
||||||
registrant: [@contact.id] })
|
registrant: [@contact.id] })
|
||||||
|
|
||||||
assert DomainVersion.was_contact_linked?(@contact.id)
|
assert Version::DomainVersion.was_contact_linked?(@contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_was_contact_linked_returns_true_when_contact_was_used_as_admin_contact
|
def test_was_contact_linked_returns_true_when_contact_was_used_as_admin_contact
|
||||||
|
@ -19,7 +19,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
tech_contacts: [],
|
tech_contacts: [],
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
|
|
||||||
assert DomainVersion.was_contact_linked?(@contact.id)
|
assert Version::DomainVersion.was_contact_linked?(@contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_was_contact_linked_returns_true_when_contact_was_used_as_tech_contact
|
def test_was_contact_linked_returns_true_when_contact_was_used_as_tech_contact
|
||||||
|
@ -27,7 +27,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
tech_contacts: [@contact.id],
|
tech_contacts: [@contact.id],
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
|
|
||||||
assert DomainVersion.was_contact_linked?(@contact.id)
|
assert Version::DomainVersion.was_contact_linked?(@contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_was_contact_linked_returns_false_when_contact_was_not_used
|
def test_was_contact_linked_returns_false_when_contact_was_not_used
|
||||||
|
@ -35,7 +35,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
tech_contacts: [],
|
tech_contacts: [],
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
|
|
||||||
assert_not DomainVersion.was_contact_linked?(@contact.id)
|
assert_not Version::DomainVersion.was_contact_linked?(@contact.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_unlinked_more_than_returns_true_when_contact_was_linked_as_registrant_more_than_given_period
|
def test_contact_unlinked_more_than_returns_true_when_contact_was_linked_as_registrant_more_than_given_period
|
||||||
|
@ -45,7 +45,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [@contact.id] })
|
registrant: [@contact.id] })
|
||||||
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
||||||
|
|
||||||
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_unlinked_more_than_given_period_as_admin_contact
|
def test_contact_unlinked_more_than_given_period_as_admin_contact
|
||||||
|
@ -55,7 +55,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
||||||
|
|
||||||
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_unlinked_more_than_given_period_as_tech_contact
|
def test_contact_unlinked_more_than_given_period_as_tech_contact
|
||||||
|
@ -65,7 +65,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
travel_to Time.zone.parse('2010-07-05 00:00:01')
|
||||||
|
|
||||||
assert DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_linked_within_given_period_as_registrant
|
def test_contact_linked_within_given_period_as_registrant
|
||||||
|
@ -75,7 +75,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [@contact.id] })
|
registrant: [@contact.id] })
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_linked_within_given_period_as_admin_contact
|
def test_contact_linked_within_given_period_as_admin_contact
|
||||||
|
@ -85,7 +85,7 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_linked_within_given_period_as_tech_contact
|
def test_contact_linked_within_given_period_as_tech_contact
|
||||||
|
@ -95,11 +95,11 @@ class DomainVersionTest < ActiveSupport::TestCase
|
||||||
registrant: [] })
|
registrant: [] })
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_was_never_linked
|
def test_contact_was_never_linked
|
||||||
DomainVersion.delete_all
|
Version::DomainVersion.delete_all
|
||||||
assert_not DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
assert_not Version::DomainVersion.contact_unlinked_more_than?(contact_id: @contact.id, period: 1.day)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ArchiveContactsTaskTest < ActiveSupport::TestCase
|
||||||
def archivable_contact
|
def archivable_contact
|
||||||
contact = contacts(:john)
|
contact = contacts(:john)
|
||||||
Setting.orphans_contacts_in_months = 0
|
Setting.orphans_contacts_in_months = 0
|
||||||
DomainVersion.delete_all
|
Version::DomainVersion.delete_all
|
||||||
|
|
||||||
other_contact = contacts(:william)
|
other_contact = contacts(:william)
|
||||||
assert_not_equal other_contact, contact
|
assert_not_equal other_contact, contact
|
||||||
|
|
|
@ -42,7 +42,7 @@ EInvoice.provider = EInvoice::Providers::TestProvider.new
|
||||||
class ActiveSupport::TestCase
|
class ActiveSupport::TestCase
|
||||||
ActiveRecord::Migration.check_pending!
|
ActiveRecord::Migration.check_pending!
|
||||||
fixtures :all
|
fixtures :all
|
||||||
set_fixture_class log_domains: DomainVersion
|
set_fixture_class log_domains: Version::DomainVersion
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
travel_back
|
travel_back
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue