113524121-min_size_changed

This commit is contained in:
Stas 2016-02-22 16:01:56 +02:00
parent b6742c0c09
commit 010dc17dd6
3 changed files with 3 additions and 21 deletions

View file

@ -1,13 +1,10 @@
class Epp::Contact < Contact
include EppErrors
attr_accessor :legal_doc
# disable STI, there is type column present
self.inheritance_column = :sti_disabled
before_validation :manage_permissions
before_validation :check_legal_doc_size
def manage_permissions
return unless update_prohibited? || delete_prohibited?
@ -15,12 +12,6 @@ class Epp::Contact < Contact
false
end
def check_legal_doc_size
if @legal_doc
return false if @legal_doc.size < 100.kilobytes
end
end
class << self
# support legacy search
def find_by_epp_code(code)
@ -49,7 +40,6 @@ class Epp::Contact < Contact
legal_frame = f.css('legalDocument').first
if legal_frame.present?
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
@legal_doc = legal_document_attrs(legal_frame)
end
at.merge!(ident_attrs(f.css('ident').first)) if new_record
at
@ -164,7 +154,6 @@ class Epp::Contact < Contact
legal_frame = frame.css('legalDocument').first
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

View file

@ -3,10 +3,9 @@ class Epp::Domain < Domain
include EppErrors
# 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 :check_legal_doc_size
def manage_permissions
return if is_admin # this bad hack for 109086524, refactor later
@ -16,12 +15,6 @@ class Epp::Domain < Domain
false
end
def check_legal_doc_size
if @legal_doc
return false if @legal_doc.size < 100.kilobytes
end
end
after_validation :validate_contacts
def validate_contacts
return true if is_renewal || is_transfer
@ -203,7 +196,6 @@ class Epp::Domain < Domain
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
at[:legal_documents_attributes] = legal_document_from(frame)
@legal_doc = at[:legal_documents_attributes]
at
end
# 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))
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
@legal_doc = doc
end
at_add = attrs_from(frame.css('add'), current_user, 'add')

View file

@ -9,6 +9,8 @@ class LegalDocument < ActiveRecord::Base
belongs_to :documentable, polymorphic: true
validates :body, length: { minimum: 1.37 * 1.4 }
before_create :add_creator
before_save :save_to_filesystem