Added registrant successful email confirmation #2557

This commit is contained in:
Priit Tark 2015-07-14 18:29:02 +03:00
parent 9f2d87606d
commit 8102b8f1a2
11 changed files with 169 additions and 18 deletions

View file

@ -186,13 +186,10 @@ class Domain < ActiveRecord::Base
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 +514,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?

View file

@ -398,7 +398,11 @@ class Epp::Domain < Domain
frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_UPDATE)
clean_pendings! if update(frame, user, false)
if update(frame, user, false)
clean_pendings!
self.deliver_emails = true # turn on email delivery for epp
DomainMailer.registrant_updated(self).deliver_now
end
end
def apply_pending_delete!
@ -429,7 +433,7 @@ class Epp::Domain < Domain
manage_automatic_statuses
true # aka 1001 pending_delete
else
destroy
set_expired!
end
end