mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch '104525314-domain-object-states' into staging
This commit is contained in:
commit
b495fbc8cc
7 changed files with 45 additions and 33 deletions
|
@ -47,6 +47,7 @@ class Admin::DomainsController < AdminController
|
||||||
def update
|
def update
|
||||||
dp = ignore_empty_statuses
|
dp = ignore_empty_statuses
|
||||||
@domain.is_admin = true
|
@domain.is_admin = true
|
||||||
|
@domain.admin_status_update dp[:statuses]
|
||||||
|
|
||||||
if @domain.update(dp)
|
if @domain.update(dp)
|
||||||
flash[:notice] = I18n.t('domain_updated')
|
flash[:notice] = I18n.t('domain_updated')
|
||||||
|
|
|
@ -64,8 +64,12 @@ class Epp::DomainsController < EppController
|
||||||
else
|
else
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
end
|
end
|
||||||
rescue
|
rescue => e
|
||||||
handle_errors(@domain)
|
if @domain.errors.any?
|
||||||
|
handle_errors(@domain)
|
||||||
|
else
|
||||||
|
throw e
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,10 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
domain.clean_pendings!
|
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
DomainMailer.pending_delete_rejected_notification(domain_id).deliver
|
DomainMailer.pending_delete_rejected_notification(domain_id).deliver
|
||||||
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||||
domain.clean_pendings!
|
domain.cancel_pending_delete
|
||||||
end
|
end
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
|
|
|
@ -492,6 +492,12 @@ class Domain < ActiveRecord::Base
|
||||||
DomainMailer.pending_deleted(id).deliver
|
DomainMailer.pending_deleted(id).deliver
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cancel_pending_delete
|
||||||
|
statuses.delete DomainStatus::PENDING_DELETE_CONFIRMATION
|
||||||
|
statuses.delete DomainStatus::PENDING_DELETE
|
||||||
|
self.delete_at = nil
|
||||||
|
end
|
||||||
|
|
||||||
def pricelist(operation, period_i = nil, unit = nil)
|
def pricelist(operation, period_i = nil, unit = nil)
|
||||||
period_i ||= period
|
period_i ||= period
|
||||||
unit ||= period_unit
|
unit ||= period_unit
|
||||||
|
@ -673,16 +679,31 @@ class Domain < ActiveRecord::Base
|
||||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# special handling for admin changing status
|
||||||
|
def admin_status_update(update)
|
||||||
|
# check for deleted status
|
||||||
|
statuses.each do |s|
|
||||||
|
unless update.includes? s
|
||||||
|
case s
|
||||||
|
when DomainStatus::PENDING_DELETE
|
||||||
|
self.delete_at = nil
|
||||||
|
# Handle any other special remove cases?
|
||||||
|
# when DomainStatus::FORCE_DELETE unset_force_delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def pending_update_prohibited?
|
def pending_update_prohibited?
|
||||||
(statuses_was & [
|
(statuses_was & [
|
||||||
DomainStatus::PENDING_DELETE_CONFIRMATION,
|
DomainStatus::PENDING_DELETE_CONFIRMATION,
|
||||||
DomainStatus::CLIENT_UPDATE_PROHIBITED,
|
DomainStatus::CLIENT_UPDATE_PROHIBITED,
|
||||||
DomainStatus::SERVER_UPDATE_PROHIBITED,
|
DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||||
DomainStatus::PENDING_CREATE,
|
DomainStatus::PENDING_CREATE,
|
||||||
DomainStatus::PENDING_UPDATE,
|
DomainStatus::PENDING_UPDATE,
|
||||||
DomainStatus::PENDING_DELETE,
|
DomainStatus::PENDING_DELETE,
|
||||||
DomainStatus::PENDING_RENEW,
|
DomainStatus::PENDING_RENEW,
|
||||||
DomainStatus::PENDING_TRANSFER
|
DomainStatus::PENDING_TRANSFER
|
||||||
]).present?
|
]).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ class DomainStatus < ActiveRecord::Base
|
||||||
INACTIVE,
|
INACTIVE,
|
||||||
FORCE_DELETE,
|
FORCE_DELETE,
|
||||||
PENDING_CREATE,
|
PENDING_CREATE,
|
||||||
PENDING_DELETE,
|
#PENDING_DELETE,
|
||||||
PENDING_RENEW,
|
PENDING_RENEW,
|
||||||
PENDING_TRANSFER,
|
PENDING_TRANSFER,
|
||||||
PENDING_UPDATE,
|
PENDING_UPDATE,
|
||||||
|
|
|
@ -236,7 +236,7 @@ class Epp::Domain < Domain
|
||||||
def admin_domain_contacts_attrs(frame, action)
|
def admin_domain_contacts_attrs(frame, action)
|
||||||
admin_attrs = domain_contact_attrs_from(frame, action, 'admin')
|
admin_attrs = domain_contact_attrs_from(frame, action, 'admin')
|
||||||
|
|
||||||
if action && !admin_attrs.empty? && admin_change_prohibited?
|
if admin_attrs.present? && admin_change_prohibited?
|
||||||
add_epp_error('2304', 'admin', DomainStatus::SERVER_ADMIN_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', 'admin', DomainStatus::SERVER_ADMIN_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
|
@ -252,7 +252,7 @@ class Epp::Domain < Domain
|
||||||
def tech_domain_contacts_attrs(frame, action)
|
def tech_domain_contacts_attrs(frame, action)
|
||||||
tech_attrs = domain_contact_attrs_from(frame, action, 'tech')
|
tech_attrs = domain_contact_attrs_from(frame, action, 'tech')
|
||||||
|
|
||||||
if action && !tech_attrs.empty? && tech_change_prohibited?
|
if tech_attrs.present? && tech_change_prohibited?
|
||||||
add_epp_error('2304', 'tech', DomainStatus::SERVER_TECH_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', 'tech', DomainStatus::SERVER_TECH_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
|
@ -443,21 +443,10 @@ class Epp::Domain < Domain
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
||||||
end
|
end
|
||||||
|
|
||||||
at_add = attrs_from(frame.css('add'), current_user)
|
at_add = attrs_from(frame.css('add'), current_user, 'add')
|
||||||
at[:nameservers_attributes] += at_add[:nameservers_attributes]
|
at[:nameservers_attributes] += at_add[:nameservers_attributes]
|
||||||
|
at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes]
|
||||||
if !at[:admin_domain_contacts_attributes].empty? && admin_change_prohibited?
|
at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes]
|
||||||
add_epp_error('2304', 'admin', DomainStatus::SERVER_ADMIN_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
|
||||||
else
|
|
||||||
at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes]
|
|
||||||
end
|
|
||||||
|
|
||||||
if !at[:tech_domain_contacts_attributes].empty? && tech_change_prohibited?
|
|
||||||
add_epp_error('2304', 'tech', DomainStatus::SERVER_TECH_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation))
|
|
||||||
else
|
|
||||||
at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes]
|
|
||||||
end
|
|
||||||
|
|
||||||
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
|
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
|
||||||
at[:statuses] =
|
at[:statuses] =
|
||||||
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
|
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
|
||||||
|
@ -498,9 +487,8 @@ class Epp::Domain < Domain
|
||||||
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
statuses.delete(DomainStatus::PENDING_DELETE)
|
statuses.delete(DomainStatus::PENDING_DELETE)
|
||||||
DomainMailer.delete_confirmation(id).deliver
|
DomainMailer.delete_confirmation(id).deliver
|
||||||
|
clean_pendings!
|
||||||
# TODO: confirm that this actually makes sense
|
set_pending_delete!
|
||||||
clean_pendings! if valid? && set_pending_delete!
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- if (status == DomainStatus::PENDING_DELETE || status == DomainStatus::PENDING_DELETE_CONFIRMATION)
|
- if status == DomainStatus::PENDING_DELETE_CONFIRMATION
|
||||||
= link_to(t(:accept_delete), 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')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue