mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Notify losing registrar
This commit is contained in:
parent
642eda06fd
commit
830c2a9497
5 changed files with 31 additions and 9 deletions
|
@ -13,8 +13,13 @@ class DomainTransfer < ActiveRecord::Base
|
|||
SERVER_CANCELLED = 'serverCancelled'
|
||||
|
||||
before_create :set_wait_until
|
||||
before_create :set_status
|
||||
def set_wait_until
|
||||
wait_time = Setting.transfer_wait_time
|
||||
return if wait_time == 0
|
||||
self.wait_until = transfer_requested_at + wait_time.hours
|
||||
end
|
||||
|
||||
before_create :set_status
|
||||
def set_status
|
||||
if Setting.transfer_wait_time > 0
|
||||
self.status = PENDING unless status
|
||||
|
@ -26,12 +31,6 @@ class DomainTransfer < ActiveRecord::Base
|
|||
|
||||
delegate :name, :valid_to, to: :domain, prefix: true
|
||||
|
||||
def set_wait_until
|
||||
wait_time = Setting.transfer_wait_time
|
||||
return if wait_time == 0
|
||||
self.wait_until = transfer_requested_at + wait_time.hours
|
||||
end
|
||||
|
||||
def approved?
|
||||
status == CLIENT_APPROVED || status == SERVER_APPROVED
|
||||
end
|
||||
|
@ -51,4 +50,12 @@ class DomainTransfer < ActiveRecord::Base
|
|||
domain.save(validate: false)
|
||||
end
|
||||
end
|
||||
|
||||
def notify_losing_registrar
|
||||
transfer_from.messages.create!(
|
||||
body: I18n.t('domain_transfer_was_approved', contacts: domain.contacts.pluck(:code)),
|
||||
attached_obj_id: id,
|
||||
attached_obj_type: self.class.to_s
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -160,7 +160,7 @@ class Epp::Domain < Domain
|
|||
def admin_domain_contacts_attrs(frame, action)
|
||||
admin_attrs = domain_contact_attrs_from(frame, action, 'admin')
|
||||
|
||||
case action
|
||||
case action
|
||||
when 'rem'
|
||||
return destroy_attrs(admin_attrs, admin_domain_contacts)
|
||||
else
|
||||
|
@ -171,7 +171,7 @@ class Epp::Domain < Domain
|
|||
def tech_domain_contacts_attrs(frame, action)
|
||||
tech_attrs = domain_contact_attrs_from(frame, action, 'tech')
|
||||
|
||||
case action
|
||||
case action
|
||||
when 'rem'
|
||||
return destroy_attrs(tech_attrs, tech_domain_contacts)
|
||||
else
|
||||
|
@ -512,6 +512,7 @@ class Epp::Domain < Domain
|
|||
|
||||
if dt.approved?
|
||||
transfer_contacts(current_user.registrar_id)
|
||||
dt.notify_losing_registrar
|
||||
generate_auth_info
|
||||
self.registrar = current_user.registrar
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue