mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 04:29:33 +02:00
Merge branch '104525314-domain-object-states' into staging
This commit is contained in:
commit
fed7ca7d57
5 changed files with 22 additions and 20 deletions
|
@ -118,6 +118,11 @@ class Domain < ActiveRecord::Base
|
||||||
validate :status_is_consistant
|
validate :status_is_consistant
|
||||||
def status_is_consistant
|
def status_is_consistant
|
||||||
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
|
||||||
|
unless has_error
|
||||||
|
if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any?
|
||||||
|
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
|
||||||
|
end
|
||||||
|
end
|
||||||
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
|
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -445,22 +450,17 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
# rubocop: disable Metrics/CyclomaticComplexity
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def registrant_update_confirmable?(token)
|
def registrant_update_confirmable?(token)
|
||||||
return true if Rails.env.development?
|
return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any?
|
||||||
return false unless pending_update?
|
return false unless pending_update?
|
||||||
return false if registrant_verification_token.blank?
|
return false unless registrant_verification_asked?
|
||||||
return false if registrant_verification_asked_at.blank?
|
return false unless registrant_verification_token == token
|
||||||
return false if token.blank?
|
|
||||||
return false if registrant_verification_token != token
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_delete_confirmable?(token)
|
def registrant_delete_confirmable?(token)
|
||||||
return true if Rails.env.development?
|
|
||||||
return false unless pending_delete?
|
return false unless pending_delete?
|
||||||
return false if registrant_verification_token.blank?
|
return false unless registrant_verification_asked?
|
||||||
return false if registrant_verification_asked_at.blank?
|
return false unless registrant_verification_token == token
|
||||||
return false if token.blank?
|
|
||||||
return false if registrant_verification_token != token
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
@ -695,7 +695,7 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_delete?
|
def pending_delete?
|
||||||
statuses.include?(DomainStatus::PENDING_DELETE) && !statuses.include?(DomainStatus::FORCE_DELETE)
|
(statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE]).any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_delete_confirmation?
|
def pending_delete_confirmation?
|
||||||
|
|
|
@ -776,12 +776,12 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
### ABILITIES ###
|
### ABILITIES ###
|
||||||
|
|
||||||
# depricated -- this is redundant TODO: try to remove
|
|
||||||
def can_be_deleted?
|
def can_be_deleted?
|
||||||
begin
|
begin
|
||||||
errors.add(:base, :domain_status_prohibits_operation)
|
errors.add(:base, :domain_status_prohibits_operation)
|
||||||
return false
|
return false
|
||||||
end if statuses.include?(DomainStatus::CLIENT_DELETE_PROHIBITED)
|
end if (statuses & [DomainStatus::CLIENT_DELETE_PROHIBITED, DomainStatus::SERVER_DELETE_PROHIBITED].any?
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
- if (status == DomainStatus::PENDING_DELETE && f.object.pending_json.present?)
|
- if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
= link_to(t(:apply_pending), admin_domain_pending_delete_path(f.object.id, f.object.id),
|
= link_to(t(:accept_delete), admin_domain_pending_delete_path(f.object.id, f.object.id),
|
||||||
method: :patch, data: { confirm: t(:are_you_sure) },
|
method: :patch, data: { confirm: t(:are_you_sure) },
|
||||||
class: 'btn btn-danger btn-xs')
|
class: 'btn btn-danger btn-xs')
|
||||||
|
|
||||||
= link_to(t(:delete_pending), admin_domain_pending_delete_path(f.object.id, f.object.id),
|
= link_to(t(:reject_delete), admin_domain_pending_delete_path(f.object.id, f.object.id),
|
||||||
method: :delete, data: { confirm: t(:are_you_sure) },
|
method: :delete, data: { confirm: t(:are_you_sure) },
|
||||||
class: 'btn btn-danger btn-xs')
|
class: 'btn btn-danger btn-xs')
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
.pull-left= t(:status)
|
.pull-left= t(:status)
|
||||||
.pull-right
|
.pull-right
|
||||||
- if model == 'domain'
|
- if model == 'domain'
|
||||||
= render 'admin/domains/form/pending_update', f: f, status: s
|
.hide-when-new
|
||||||
= render 'admin/domains/form/pending_delete', f: f, status: s
|
= render 'admin/domains/form/pending_update', f: f, status: s
|
||||||
|
= render 'admin/domains/form/pending_delete', f: f, status: s
|
||||||
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
|
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
|
||||||
.panel-body
|
.panel-body
|
||||||
.form-group
|
.form-group
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
if el.find('.js-disabled-value')
|
if el.find('.js-disabled-value')
|
||||||
el.find('.js-disabled-value').remove()
|
el.find('.js-disabled-value').remove()
|
||||||
el.find('.js-select').show()
|
el.find('.js-select').show()
|
||||||
|
el.find('.hide-when-new').hide()
|
||||||
el.find('.js-destroy-status').show()
|
el.find('.js-destroy-status').show()
|
||||||
|
|
||||||
$(document).on 'click', '.js-destroy-status', (e) ->
|
$(document).on 'click', '.js-destroy-status', (e) ->
|
||||||
|
|
|
@ -2444,9 +2444,9 @@ describe 'EPP Domain', epp: true do
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml)
|
response = epp_plain_request(xml)
|
||||||
response[:results][0][:msg].should start_with
|
response[:results][0][:msg].should start_with(
|
||||||
"Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\
|
"Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\
|
||||||
"[facet 'enumeration'] The value 'invalidStatus' is not an element of the set "
|
"[facet 'enumeration'] The value 'invalidStatus' is not an element of the set ")
|
||||||
response[:results][0][:result_code].should == '2001'
|
response[:results][0][:result_code].should == '2001'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue