mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +02:00
Merge branch 'master' of github.com:domify/registry
Conflicts: config/locales/en.yml
This commit is contained in:
commit
e722da3ed8
22 changed files with 249 additions and 34 deletions
|
@ -183,16 +183,34 @@ class Domain < ActiveRecord::Base
|
|||
)
|
||||
end
|
||||
|
||||
def clean_expired_pendings
|
||||
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
||||
|
||||
expire_at = Setting.expire_pending_confirmation.hours.ago
|
||||
count = 0
|
||||
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
||||
expired_pending_domains.each do |domain|
|
||||
unless domain.pending_update? || domain.pending_delete?
|
||||
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
|
||||
"but no pendingDelete/pendingUpdate state present!\n"
|
||||
STDOUT << msg unless Rails.env.test?
|
||||
next
|
||||
end
|
||||
count += 1
|
||||
domain.clean_pendings!
|
||||
end
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
|
||||
count
|
||||
end
|
||||
|
||||
def start_expire_period
|
||||
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
||||
|
||||
d = Domain.where('valid_to <= ?', Time.zone.now)
|
||||
d.each do |x|
|
||||
next unless x.expirable?
|
||||
x.statuses << DomainStatus::EXPIRED
|
||||
# TODO: This should be managed by automatic_statuses
|
||||
x.statuses.delete(DomainStatus::OK)
|
||||
x.save(validate: false)
|
||||
domains = Domain.where('valid_to <= ?', Time.zone.now)
|
||||
domains.each do |domain|
|
||||
next unless domain.expirable?
|
||||
domain.set_expired!
|
||||
end
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
|
||||
|
@ -517,6 +535,19 @@ class Domain < ActiveRecord::Base
|
|||
save(validate: false)
|
||||
end
|
||||
|
||||
def set_expired
|
||||
# TODO: currently valid_to attribute update logic is open
|
||||
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
|
||||
self.outzone_at = Time.zone.now + Setting.expire_warning_period.days
|
||||
self.delete_at = Time.zone.now + Setting.redemption_grace_period.days
|
||||
statuses << DomainStatus::EXPIRED
|
||||
end
|
||||
|
||||
def set_expired!
|
||||
set_expired
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
def manage_automatic_statuses
|
||||
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
|
||||
if statuses.empty? && valid?
|
||||
|
|
|
@ -398,7 +398,10 @@ class Epp::Domain < Domain
|
|||
frame = Nokogiri::XML(pending_json['frame'])
|
||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
|
||||
clean_pendings! if update(frame, user, false)
|
||||
return unless update(frame, user, false)
|
||||
clean_pendings!
|
||||
self.deliver_emails = true # turn on email delivery for epp
|
||||
DomainMailer.registrant_updated(self).deliver_now
|
||||
end
|
||||
|
||||
def apply_pending_delete!
|
||||
|
@ -429,7 +432,7 @@ class Epp::Domain < Domain
|
|||
manage_automatic_statuses
|
||||
true # aka 1001 pending_delete
|
||||
else
|
||||
destroy
|
||||
set_expired!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue