mirror of
https://github.com/internetee/registry.git
synced 2025-05-22 04:09:52 +02:00
113524121-min_size_changed
This commit is contained in:
parent
b6742c0c09
commit
010dc17dd6
3 changed files with 3 additions and 21 deletions
|
@ -1,13 +1,10 @@
|
||||||
class Epp::Contact < Contact
|
class Epp::Contact < Contact
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
attr_accessor :legal_doc
|
|
||||||
|
|
||||||
# disable STI, there is type column present
|
# disable STI, there is type column present
|
||||||
self.inheritance_column = :sti_disabled
|
self.inheritance_column = :sti_disabled
|
||||||
|
|
||||||
before_validation :manage_permissions
|
before_validation :manage_permissions
|
||||||
before_validation :check_legal_doc_size
|
|
||||||
|
|
||||||
def manage_permissions
|
def manage_permissions
|
||||||
return unless update_prohibited? || delete_prohibited?
|
return unless update_prohibited? || delete_prohibited?
|
||||||
|
@ -15,12 +12,6 @@ class Epp::Contact < Contact
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_legal_doc_size
|
|
||||||
if @legal_doc
|
|
||||||
return false if @legal_doc.size < 100.kilobytes
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# support legacy search
|
# support legacy search
|
||||||
def find_by_epp_code(code)
|
def find_by_epp_code(code)
|
||||||
|
@ -49,7 +40,6 @@ class Epp::Contact < Contact
|
||||||
legal_frame = f.css('legalDocument').first
|
legal_frame = f.css('legalDocument').first
|
||||||
if legal_frame.present?
|
if legal_frame.present?
|
||||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
||||||
@legal_doc = legal_document_attrs(legal_frame)
|
|
||||||
end
|
end
|
||||||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||||
at
|
at
|
||||||
|
@ -164,7 +154,6 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
legal_frame = frame.css('legalDocument').first
|
legal_frame = frame.css('legalDocument').first
|
||||||
at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
||||||
@legal_doc = at[:legal_documents_attributes]
|
|
||||||
self.deliver_emails = true # turn on email delivery for epp
|
self.deliver_emails = true # turn on email delivery for epp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,9 @@ class Epp::Domain < Domain
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
# TODO: remove this spagetti once data in production is correct.
|
# TODO: remove this spagetti once data in production is correct.
|
||||||
attr_accessor :is_renewal, :is_transfer, :legal_doc
|
attr_accessor :is_renewal, :is_transfer
|
||||||
|
|
||||||
before_validation :manage_permissions
|
before_validation :manage_permissions
|
||||||
before_validation :check_legal_doc_size
|
|
||||||
|
|
||||||
def manage_permissions
|
def manage_permissions
|
||||||
return if is_admin # this bad hack for 109086524, refactor later
|
return if is_admin # this bad hack for 109086524, refactor later
|
||||||
|
@ -16,12 +15,6 @@ class Epp::Domain < Domain
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_legal_doc_size
|
|
||||||
if @legal_doc
|
|
||||||
return false if @legal_doc.size < 100.kilobytes
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
after_validation :validate_contacts
|
after_validation :validate_contacts
|
||||||
def validate_contacts
|
def validate_contacts
|
||||||
return true if is_renewal || is_transfer
|
return true if is_renewal || is_transfer
|
||||||
|
@ -203,7 +196,6 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
||||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
at[:legal_documents_attributes] = legal_document_from(frame)
|
||||||
@legal_doc = at[:legal_documents_attributes]
|
|
||||||
at
|
at
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
@ -485,7 +477,6 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
@legal_doc = doc
|
|
||||||
end
|
end
|
||||||
|
|
||||||
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
||||||
|
|
|
@ -9,6 +9,8 @@ class LegalDocument < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :documentable, polymorphic: true
|
belongs_to :documentable, polymorphic: true
|
||||||
|
|
||||||
|
validates :body, length: { minimum: 1.37 * 1.4 }
|
||||||
|
|
||||||
before_create :add_creator
|
before_create :add_creator
|
||||||
before_save :save_to_filesystem
|
before_save :save_to_filesystem
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue