mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Merge branch 'story/116761157-contact-dyn-states' into staging
This commit is contained in:
commit
1063807528
1 changed files with 5 additions and 7 deletions
|
@ -36,7 +36,6 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
validate :val_ident_type
|
||||
validate :val_ident_valid_format?
|
||||
validate :uniq_statuses?
|
||||
validate :validate_html
|
||||
validate :val_country_code
|
||||
|
||||
|
@ -268,12 +267,16 @@ class Contact < ActiveRecord::Base
|
|||
calculated = Array(read_attribute(:statuses))
|
||||
calculated.delete(Contact::OK)
|
||||
calculated.delete(Contact::LINKED)
|
||||
calculated << Contact::OK if calculated.empty? && valid?
|
||||
calculated << Contact::OK if calculated.empty?# && valid?
|
||||
calculated << Contact::LINKED if domains_present?
|
||||
|
||||
calculated.uniq
|
||||
end
|
||||
|
||||
def statuses= arr
|
||||
write_attribute(:statuses, Array(arr).uniq)
|
||||
end
|
||||
|
||||
def to_s
|
||||
name || '[no name]'
|
||||
end
|
||||
|
@ -313,11 +316,6 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def uniq_statuses?
|
||||
return true unless statuses.detect { |s| statuses.count(s) > 1 }
|
||||
errors.add(:statuses, :not_uniq)
|
||||
false
|
||||
end
|
||||
|
||||
def org?
|
||||
ident_type == ORG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue