mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Add a setting to see if legaldocs are mandatory
This commit is contained in:
parent
f7994e599a
commit
a80e813632
5 changed files with 37 additions and 3 deletions
|
@ -4,7 +4,11 @@ module Concerns
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
def legaldoc_mandatory?
|
||||
!legaldoc_optout
|
||||
!legaldoc_not_mandatory?
|
||||
end
|
||||
|
||||
def legaldoc_not_mandatory?
|
||||
legaldoc_optout || !Setting.legal_document_is_mandatory
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ class Setting < RailsSettings::Base
|
|||
source Rails.root.join('config', 'app.yml')
|
||||
|
||||
# When config/app.yml has changed, you need change this prefix to v2, v3 ... to expires caches
|
||||
# cache_prefix { "v1" }
|
||||
cache_prefix { 'v2' }
|
||||
|
||||
def self.reload_settings!
|
||||
STDOUT << "#{Time.zone.now.utc} - Clearing settings cache\n"
|
||||
|
@ -68,6 +68,7 @@ class Setting < RailsSettings::Base
|
|||
request_confirmation_on_domain_deletion_enabled
|
||||
nameserver_required
|
||||
address_processing
|
||||
legal_document_is_mandatory
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
= render 'setting_row', var: :ns_min_count
|
||||
= render 'setting_row', var: :ns_max_count
|
||||
= render 'setting_row', var: :expire_pending_confirmation
|
||||
= render 'setting_row', var: :legal_document_is_mandatory
|
||||
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
|
|
|
@ -6,6 +6,7 @@ defaults: &defaults
|
|||
tech_contacts_max_count: 10
|
||||
orphans_contacts_in_months: 6
|
||||
expire_pending_confirmation: 48
|
||||
legal_document_is_mandatory: true
|
||||
|
||||
ds_digest_type: 2
|
||||
ds_data_allowed: false
|
||||
|
|
|
@ -238,6 +238,33 @@ class RegistrarTest < ActiveSupport::TestCase
|
|||
assert_equal iban, registrar.e_invoice_iban
|
||||
end
|
||||
|
||||
def test_legal_doc_is_mandatory
|
||||
old_value = Setting.legal_document_is_mandatory
|
||||
Setting.legal_document_is_mandatory = true
|
||||
assert @registrar.legaldoc_mandatory?
|
||||
|
||||
Setting.legal_document_is_mandatory = old_value
|
||||
end
|
||||
|
||||
def test_legal_doc_is_not_mandatory_if_opted_out
|
||||
old_value = Setting.legal_document_is_mandatory
|
||||
Setting.legal_document_is_mandatory = true
|
||||
@registrar.legaldoc_optout = true
|
||||
@registrar.save(validate: false)
|
||||
@registrar.reload
|
||||
assert_not @registrar.legaldoc_mandatory?
|
||||
|
||||
Setting.legal_document_is_mandatory = old_value
|
||||
end
|
||||
|
||||
def test_legal_doc_is_not_mandatory_globally
|
||||
old_value = Setting.legal_document_is_mandatory
|
||||
Setting.legal_document_is_mandatory = false
|
||||
assert_not @registrar.legaldoc_mandatory?
|
||||
|
||||
Setting.legal_document_is_mandatory = old_value
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_registrar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue