mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
Merge pull request #2546 from internetee/renovate/ransack-4.x
Update dependency ransack to v4
This commit is contained in:
commit
cecafea256
24 changed files with 231 additions and 124 deletions
4
.github/workflows/ruby.yml
vendored
4
.github/workflows/ruby.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-18.04]
|
os: [ubuntu-22.04]
|
||||||
ruby: [ '2.7', '3.0.3' ]
|
ruby: [ '2.7', '3.0.3' ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
||||||
|
@ -89,7 +89,7 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
ruby: [ '2.7', '3.0.3' ]
|
ruby: [ '2.7', '3.0.3' ]
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||||
|
|
4
Gemfile
4
Gemfile
|
@ -19,7 +19,7 @@ gem 'figaro', '~> 1.2'
|
||||||
gem 'paper_trail', '~> 14.0'
|
gem 'paper_trail', '~> 14.0'
|
||||||
gem 'pg', '1.4.5'
|
gem 'pg', '1.4.5'
|
||||||
# 1.8 is for Rails < 5.0
|
# 1.8 is for Rails < 5.0
|
||||||
gem 'ransack', '~> 2.6.0'
|
gem 'ransack', '~> 4.0.0'
|
||||||
gem 'truemail', '~> 3.0' # validates email by regexp, mail server existence and address existence
|
gem 'truemail', '~> 3.0' # validates email by regexp, mail server existence and address existence
|
||||||
gem 'validates_email_format_of', '1.7.2' # validates email against RFC 2822 and RFC 3696
|
gem 'validates_email_format_of', '1.7.2' # validates email against RFC 2822 and RFC 3696
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
|
||||||
gem 'haml', '~> 6.0'
|
gem 'haml', '~> 6.0'
|
||||||
gem 'lhv', github: 'internetee/lhv', branch: 'master'
|
gem 'lhv', github: 'internetee/lhv', branch: 'master'
|
||||||
gem 'rexml'
|
gem 'rexml'
|
||||||
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'
|
gem 'wkhtmltopdf-binary', '~> 0.12.6.1'
|
||||||
|
|
||||||
gem 'directo', github: 'internetee/directo', branch: 'master'
|
gem 'directo', github: 'internetee/directo', branch: 'master'
|
||||||
|
|
||||||
|
|
132
Gemfile.lock
132
Gemfile.lock
|
@ -77,40 +77,40 @@ GIT
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (6.1.4.1)
|
actioncable (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (6.1.4.1)
|
actionmailbox (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
activejob (= 6.1.4.1)
|
activejob (= 6.1.7.3)
|
||||||
activerecord (= 6.1.4.1)
|
activerecord (= 6.1.7.3)
|
||||||
activestorage (= 6.1.4.1)
|
activestorage (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
actionmailer (6.1.4.1)
|
actionmailer (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
actionview (= 6.1.4.1)
|
actionview (= 6.1.7.3)
|
||||||
activejob (= 6.1.4.1)
|
activejob (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (6.1.4.1)
|
actionpack (6.1.7.3)
|
||||||
actionview (= 6.1.4.1)
|
actionview (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
rack (~> 2.0, >= 2.0.9)
|
rack (~> 2.0, >= 2.0.9)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (6.1.4.1)
|
actiontext (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
activerecord (= 6.1.4.1)
|
activerecord (= 6.1.7.3)
|
||||||
activestorage (= 6.1.4.1)
|
activestorage (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (6.1.4.1)
|
actionview (6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
|
@ -118,22 +118,22 @@ GEM
|
||||||
active_interaction (4.0.5)
|
active_interaction (4.0.5)
|
||||||
activemodel (>= 5, < 7)
|
activemodel (>= 5, < 7)
|
||||||
activesupport (>= 5, < 7)
|
activesupport (>= 5, < 7)
|
||||||
activejob (6.1.4.1)
|
activejob (6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (6.1.4.1)
|
activemodel (6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
activerecord (6.1.4.1)
|
activerecord (6.1.7.3)
|
||||||
activemodel (= 6.1.4.1)
|
activemodel (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
activestorage (6.1.4.1)
|
activestorage (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
activejob (= 6.1.4.1)
|
activejob (= 6.1.7.3)
|
||||||
activerecord (= 6.1.4.1)
|
activerecord (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
marcel (~> 1.0.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
mini_mime (>= 1.1.0)
|
||||||
activesupport (6.1.4.1)
|
activesupport (6.1.7.3)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
|
@ -194,7 +194,7 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.1.10)
|
concurrent-ruby (1.2.2)
|
||||||
connection_pool (2.2.5)
|
connection_pool (2.2.5)
|
||||||
countries (4.0.1)
|
countries (4.0.1)
|
||||||
i18n_data (~> 0.13.0)
|
i18n_data (~> 0.13.0)
|
||||||
|
@ -310,7 +310,7 @@ GEM
|
||||||
rake
|
rake
|
||||||
mini_mime (1.1.2)
|
mini_mime (1.1.2)
|
||||||
mini_portile2 (2.8.0)
|
mini_portile2 (2.8.0)
|
||||||
minitest (5.17.0)
|
minitest (5.18.0)
|
||||||
monetize (1.9.4)
|
monetize (1.9.4)
|
||||||
money (~> 6.12)
|
money (~> 6.12)
|
||||||
money (6.13.8)
|
money (6.13.8)
|
||||||
|
@ -383,36 +383,36 @@ GEM
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (6.1.4.1)
|
rails (6.1.7.3)
|
||||||
actioncable (= 6.1.4.1)
|
actioncable (= 6.1.7.3)
|
||||||
actionmailbox (= 6.1.4.1)
|
actionmailbox (= 6.1.7.3)
|
||||||
actionmailer (= 6.1.4.1)
|
actionmailer (= 6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
actiontext (= 6.1.4.1)
|
actiontext (= 6.1.7.3)
|
||||||
actionview (= 6.1.4.1)
|
actionview (= 6.1.7.3)
|
||||||
activejob (= 6.1.4.1)
|
activejob (= 6.1.7.3)
|
||||||
activemodel (= 6.1.4.1)
|
activemodel (= 6.1.7.3)
|
||||||
activerecord (= 6.1.4.1)
|
activerecord (= 6.1.7.3)
|
||||||
activestorage (= 6.1.4.1)
|
activestorage (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 6.1.4.1)
|
railties (= 6.1.7.3)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.4.4)
|
rails-html-sanitizer (1.4.4)
|
||||||
loofah (~> 2.19, >= 2.19.1)
|
loofah (~> 2.19, >= 2.19.1)
|
||||||
railties (6.1.4.1)
|
railties (6.1.7.3)
|
||||||
actionpack (= 6.1.4.1)
|
actionpack (= 6.1.7.3)
|
||||||
activesupport (= 6.1.4.1)
|
activesupport (= 6.1.7.3)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.13)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
ransack (2.6.0)
|
ransack (4.0.0)
|
||||||
activerecord (>= 6.0.4)
|
activerecord (>= 6.1.5)
|
||||||
activesupport (>= 6.0.4)
|
activesupport (>= 6.1.5)
|
||||||
i18n
|
i18n
|
||||||
rbtree3 (0.6.0)
|
rbtree3 (0.6.0)
|
||||||
redis (4.6.0)
|
redis (4.6.0)
|
||||||
|
@ -486,7 +486,7 @@ GEM
|
||||||
timeout (0.3.0)
|
timeout (0.3.0)
|
||||||
truemail (3.0.3)
|
truemail (3.0.3)
|
||||||
simpleidn (~> 0.2.1)
|
simpleidn (~> 0.2.1)
|
||||||
tzinfo (2.0.5)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
uglifier (4.2.0)
|
uglifier (4.2.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
|
@ -523,10 +523,10 @@ GEM
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
whenever (1.0.0)
|
whenever (1.0.0)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
wkhtmltopdf-binary (0.12.5.4)
|
wkhtmltopdf-binary (0.12.6.6)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.6.6)
|
zeitwerk (2.6.7)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -580,7 +580,7 @@ DEPENDENCIES
|
||||||
pry (= 0.14.2)
|
pry (= 0.14.2)
|
||||||
puma
|
puma
|
||||||
rails (~> 6.1.4)
|
rails (~> 6.1.4)
|
||||||
ransack (~> 2.6.0)
|
ransack (~> 4.0.0)
|
||||||
rest-client
|
rest-client
|
||||||
rexml
|
rexml
|
||||||
sass-rails
|
sass-rails
|
||||||
|
@ -597,7 +597,7 @@ DEPENDENCIES
|
||||||
webdrivers
|
webdrivers
|
||||||
webmock
|
webmock
|
||||||
whenever (= 1.0.0)
|
whenever (= 1.0.0)
|
||||||
wkhtmltopdf-binary (~> 0.12.5.1)
|
wkhtmltopdf-binary (~> 0.12.6.1)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.3
|
2.4.8
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def sortable_dispute_query_for(disputes, query, closed: false)
|
def sortable_dispute_query_for(disputes, query, closed: false)
|
||||||
@q = disputes.order(:domain_name).search(query)
|
@q = disputes.order(:domain_name).ransack(query)
|
||||||
disputes = @q.result.page(closed ? params[:closed_page] : params[:page])
|
disputes = @q.result.page(closed ? params[:closed_page] : params[:page])
|
||||||
return disputes.per(params[:results_per_page]) if params[:results_per_page].present?
|
return disputes.per(params[:results_per_page]) if params[:results_per_page].present?
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Account < ApplicationRecord
|
||||||
|
|
||||||
validates :account_type, presence: true
|
validates :account_type, presence: true
|
||||||
|
|
||||||
CASH = 'cash'
|
CASH = 'cash'.freeze
|
||||||
|
|
||||||
def activities
|
def activities
|
||||||
account_activities
|
account_activities
|
||||||
|
@ -16,7 +16,15 @@ class Account < ApplicationRecord
|
||||||
[id, balance, currency, registrar]
|
[id, balance, currency, registrar]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.csv_header
|
def self.csv_header
|
||||||
['Id', 'Balance', 'Currency', 'Registrar']
|
%w[Id Balance Currency Registrar]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,14 @@ class AccountActivity < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def types_for_select
|
def types_for_select
|
||||||
[CREATE, RENEW, ADD_CREDIT, UPDATE_CREDIT].map { |x| [I18n.t(x), x] }
|
[CREATE, RENEW, ADD_CREDIT, UPDATE_CREDIT].map { |x| [I18n.t(x), x] }
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,5 +4,13 @@ module ApiLog
|
||||||
# to_sym is needed because passing a string to ActiveRecord::Base.establish_connection
|
# to_sym is needed because passing a string to ActiveRecord::Base.establish_connection
|
||||||
# for a configuration lookup is deprecated
|
# for a configuration lookup is deprecated
|
||||||
establish_connection "api_log_#{Rails.env}".to_sym
|
establish_connection "api_log_#{Rails.env}".to_sym
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,14 @@ class Auction < ApplicationRecord
|
||||||
where('domain ilike ?', "%#{domain_name.strip}%") if domain_name.present?
|
where('domain ilike ?', "%#{domain_name.strip}%") if domain_name.present?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.pending(domain_name)
|
def self.pending(domain_name)
|
||||||
find_by(domain: domain_name.to_s, status: PENDING_STATUSES)
|
find_by(domain: domain_name.to_s, status: PENDING_STATUSES)
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,10 @@ class BankStatement < ApplicationRecord
|
||||||
PARTIALLY_BINDED = 'partially_binded'.freeze
|
PARTIALLY_BINDED = 'partially_binded'.freeze
|
||||||
NOT_BINDED = 'not_binded'.freeze
|
NOT_BINDED = 'not_binded'.freeze
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: Cache this to database so it can be used for searching
|
# TODO: Cache this to database so it can be used for searching
|
||||||
def status
|
def status
|
||||||
if bank_transactions.unbinded.count == bank_transactions.count
|
if bank_transactions.unbinded.count == bank_transactions.count
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BankTransaction < ApplicationRecord
|
class BankTransaction < ApplicationRecord # rubocop:disable Metrics/ClassLength
|
||||||
include Versions
|
include Versions
|
||||||
include TransactionPaidInvoices
|
include TransactionPaidInvoices
|
||||||
belongs_to :bank_statement
|
belongs_to :bank_statement
|
||||||
|
@ -8,6 +8,14 @@ class BankTransaction < ApplicationRecord
|
||||||
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
where('id NOT IN (SELECT bank_transaction_id FROM account_activities where bank_transaction_id IS NOT NULL)')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def binded?
|
def binded?
|
||||||
account_activity.present?
|
account_activity.present?
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,10 @@ module Billing
|
||||||
new_record? || duration_changed?
|
new_record? || duration_changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.operation_categories
|
def self.operation_categories
|
||||||
%w[create renew]
|
%w[create renew]
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,14 +5,21 @@ class BlockedDomain < ApplicationRecord
|
||||||
|
|
||||||
validates :name, domain_name: true, uniqueness: true
|
validates :name, domain_name: true, uniqueness: true
|
||||||
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def by_domain(name)
|
def by_domain(name)
|
||||||
where(name: name)
|
where(name: name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def name= val
|
def name=(val)
|
||||||
super SimpleIDN.to_unicode(val)
|
super SimpleIDN.to_unicode(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,14 @@ class Contact < ApplicationRecord
|
||||||
#
|
#
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def search_by_query(query)
|
def search_by_query(query)
|
||||||
res = search(code_cont: query).result
|
res = search(code_cont: query).result
|
||||||
res.reduce([]) { |o, v| o << { id: v[:id], display_key: "#{v.name} (#{v.code})" } }
|
res.reduce([]) { |o, v| o << { id: v[:id], display_key: "#{v.name} (#{v.code})" } }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Dispute < ApplicationRecord
|
class Dispute < ApplicationRecord # rubocop:disable Metrics/ClassLength
|
||||||
include WhoisStatusPopulate
|
include WhoisStatusPopulate
|
||||||
validates :domain_name, :password, :starts_at, :expires_at, presence: true
|
validates :domain_name, :password, :starts_at, :expires_at, presence: true
|
||||||
before_validation :fill_empty_passwords, :set_expiry_date
|
before_validation :fill_empty_passwords, :set_expiry_date
|
||||||
|
@ -21,6 +21,14 @@ class Dispute < ApplicationRecord
|
||||||
Domain.find_by(name: domain_name)
|
Domain.find_by(name: domain_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.close_by_domain(domain_name)
|
def self.close_by_domain(domain_name)
|
||||||
dispute = Dispute.active.find_by(domain_name: domain_name)
|
dispute = Dispute.active.find_by(domain_name: domain_name)
|
||||||
return false unless dispute
|
return false unless dispute
|
||||||
|
|
|
@ -245,6 +245,14 @@ class Domain < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def nameserver_required?
|
def nameserver_required?
|
||||||
Setting.nameserver_required
|
Setting.nameserver_required
|
||||||
end
|
end
|
||||||
|
@ -760,7 +768,7 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
def as_pdf
|
def as_pdf
|
||||||
domain_html = ApplicationController.render(template: 'domain/pdf', assigns: { domain: self })
|
domain_html = ApplicationController.render(template: 'domain/pdf', assigns: { domain: self })
|
||||||
generator = PDFKit.new(domain_html)
|
generator = PDFKit.new(domain_html, { enable_local_file_access: true })
|
||||||
generator.to_pdf
|
generator.to_pdf
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,14 @@ class Invoice < ApplicationRecord
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.csv_header
|
def self.csv_header
|
||||||
['Number', 'Buyer', 'Due Date', 'Receipt Date', 'Issue Date', 'Total', 'Currency', 'Seller Name']
|
['Number', 'Buyer', 'Due Date', 'Receipt Date', 'Issue Date', 'Total', 'Currency', 'Seller Name']
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Invoice
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_pdf
|
def as_pdf
|
||||||
generator = PDFKit.new(invoice_html)
|
generator = PDFKit.new(invoice_html, { enable_local_file_access: true })
|
||||||
generator.to_pdf
|
generator.to_pdf
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,24 @@ class ReservedDomain < ApplicationRecord
|
||||||
self.ignored_columns = %w[legacy_id]
|
self.ignored_columns = %w[legacy_id]
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
def ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def pw_for(domain_name)
|
def pw_for(domain_name)
|
||||||
name_in_ascii = SimpleIDN.to_ascii(domain_name)
|
name_in_ascii = SimpleIDN.to_ascii(domain_name)
|
||||||
by_domain(domain_name).first.try(:password) || by_domain(name_in_ascii).first.try(:password)
|
by_domain(domain_name).first.try(:password) || by_domain(name_in_ascii).first.try(:password)
|
||||||
end
|
end
|
||||||
|
|
||||||
def by_domain name
|
def by_domain(name)
|
||||||
where(name: name)
|
where(name: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_password_for name
|
def new_password_for(name)
|
||||||
record = by_domain(name).first
|
record = by_domain(name).first
|
||||||
return unless record
|
return unless record
|
||||||
|
|
||||||
|
@ -31,7 +39,7 @@ class ReservedDomain < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def name= val
|
def name=(val)
|
||||||
super SimpleIDN.to_unicode(val)
|
super SimpleIDN.to_unicode(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,18 @@ class Version::ContactVersion < PaperTrail::Version
|
||||||
contact.ident_human_description,
|
contact.ident_human_description,
|
||||||
contact.registrar,
|
contact.registrar,
|
||||||
event,
|
event,
|
||||||
created_at.to_formatted_s(:db)
|
created_at.to_formatted_s(:db),
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.csv_header
|
def self.csv_header
|
||||||
['Name', 'ID', 'Ident', 'Registrar', 'Action', 'Created at']
|
['Name', 'ID', 'Ident', 'Registrar', 'Action', 'Created at']
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,14 @@ class Version::DomainVersion < PaperTrail::Version
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ransackable_attributes(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.ransackable_associations(auth_object = nil)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def self.was_contact_linked?(contact_id)
|
def self.was_contact_linked?(contact_id)
|
||||||
sql = <<-SQL
|
sql = <<-SQL
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
@ -96,5 +96,7 @@ module DomainNameRegistry
|
||||||
config.active_record.belongs_to_required_by_default = false
|
config.active_record.belongs_to_required_by_default = false
|
||||||
|
|
||||||
config.action_dispatch.trusted_proxies = %w(127.0.0.1/32).map { |proxy| IPAddr.new(proxy) }
|
config.action_dispatch.trusted_proxies = %w(127.0.0.1/32).map { |proxy| IPAddr.new(proxy) }
|
||||||
|
|
||||||
|
config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,12 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
|
||||||
adapter = ENV["shunter_default_adapter"].constantize.new
|
adapter = ENV['shunter_default_adapter'].constantize.new
|
||||||
adapter&.clear!
|
adapter&.clear!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_new_contact
|
def test_creates_new_contact
|
||||||
request_body = {
|
request_body = {
|
||||||
contact: {
|
contact: {
|
||||||
name: 'Donald Trump',
|
name: 'Donald Trump',
|
||||||
phone: '+372.51111112',
|
phone: '+372.51111112',
|
||||||
|
@ -60,8 +60,8 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
street: 'Wismari 13',
|
street: 'Wismari 13',
|
||||||
zip: '12345',
|
zip: '12345',
|
||||||
country_code: 'EE',
|
country_code: 'EE',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||||
|
@ -83,17 +83,17 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
def test_requires_contact_address_when_processing_enabled
|
def test_requires_contact_address_when_processing_enabled
|
||||||
Setting.address_processing = true
|
Setting.address_processing = true
|
||||||
|
|
||||||
request_body = {
|
request_body = {
|
||||||
"contact": {
|
"contact": {
|
||||||
"name": "Donald Trump",
|
"name": 'Donald Trump',
|
||||||
"phone": "+372.51111112",
|
"phone": '+372.51111112',
|
||||||
"email": "donald@trumptower.com",
|
"email": 'donald@trumptower.com',
|
||||||
"ident": {
|
"ident": {
|
||||||
"ident_type": "priv",
|
'ident_type': 'priv',
|
||||||
"ident_country_code": "EE",
|
'ident_country_code': 'EE',
|
||||||
"ident": "39708290069"
|
'ident': '39708290069',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||||
|
@ -107,17 +107,17 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_validates_ident_code
|
def test_validates_ident_code
|
||||||
request_body = {
|
request_body = {
|
||||||
"contact": {
|
"contact": {
|
||||||
"name": "Donald Trump",
|
"name": 'Donald Trump',
|
||||||
"phone": "+372.51111112",
|
"phone": '+372.51111112',
|
||||||
"email": "donald@trumptower.com",
|
"email": 'donald@trumptower.com',
|
||||||
"ident": {
|
"ident": {
|
||||||
"ident_type": "priv",
|
"ident_type": 'priv',
|
||||||
"ident_country_code": "EE",
|
"ident_country_code": 'EE',
|
||||||
"ident": "123123123"
|
"ident": '123123123',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||||
|
@ -158,10 +158,10 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_error_response_if_throttled
|
def test_returns_error_response_if_throttled
|
||||||
ENV["shunter_default_threshold"] = '1'
|
ENV['shunter_default_threshold'] = '1'
|
||||||
ENV["shunter_enabled"] = 'true'
|
ENV['shunter_enabled'] = 'true'
|
||||||
|
|
||||||
request_body = {
|
request_body = {
|
||||||
contact: {
|
contact: {
|
||||||
name: 'Donald Trump',
|
name: 'Donald Trump',
|
||||||
phone: '+372.51111112',
|
phone: '+372.51111112',
|
||||||
|
@ -181,7 +181,7 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
assert_equal json[:code], 2502
|
assert_equal json[:code], 2502
|
||||||
assert response.body.include?(Shunter.default_error_message)
|
assert response.body.include?(Shunter.default_error_message)
|
||||||
ENV["shunter_default_threshold"] = '10000'
|
ENV['shunter_default_threshold'] = '10000'
|
||||||
ENV["shunter_enabled"] = 'false'
|
ENV['shunter_enabled'] = 'false'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,7 @@ class PaperTrailLearningTest < ActiveSupport::TestCase
|
||||||
t.string :title
|
t.string :title
|
||||||
|
|
||||||
# Otherwise `touch` fails silently
|
# Otherwise `touch` fails silently
|
||||||
|
t.datetime :created_at
|
||||||
t.datetime :updated_at
|
t.datetime :updated_at
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,12 +51,9 @@ class InvoiceTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_calculates_subtotal
|
def test_calculates_subtotal
|
||||||
line_item = InvoiceItem.new
|
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||||
invoice = Invoice.new(items: [line_item, line_item])
|
invoice = Invoice.new(items: [line_item, line_item.dup])
|
||||||
|
assert_equal BigDecimal(5), invoice.subtotal
|
||||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
|
||||||
assert_equal BigDecimal(5), invoice.subtotal
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_persisted_total
|
def test_returns_persisted_total
|
||||||
|
@ -64,14 +61,10 @@ class InvoiceTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_calculates_total
|
def test_calculates_total
|
||||||
line_item = InvoiceItem.new
|
line_item = InvoiceItem.new(price: BigDecimal('2.5'), quantity: 1)
|
||||||
invoice = Invoice.new
|
invoice = Invoice.new(vat_rate: 10)
|
||||||
invoice.vat_rate = 10
|
invoice.items = [line_item, line_item.dup]
|
||||||
invoice.items = [line_item, line_item]
|
assert_equal BigDecimal('5.50'), invoice.total
|
||||||
|
|
||||||
line_item.stub(:item_sum_without_vat, BigDecimal('2.5')) do
|
|
||||||
assert_equal BigDecimal('5.50'), invoice.total
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_valid_without_buyer_vat_no
|
def test_valid_without_buyer_vat_no
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue