Add force delete message to poll #2882

This commit is contained in:
Martin Lensment 2015-08-25 10:50:31 +03:00
parent fbd281007c
commit 827e3f8a0d
6 changed files with 30 additions and 4 deletions

View file

@ -577,7 +577,14 @@ class Domain < ActiveRecord::Base
end
self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at
save(validate: false)
transaction do
save!(validate: false)
registrar.messages.create!(
body: I18n.t('force_delete_set_on_domain', domain: name)
)
return true
end
false
end
# rubocop:enable Metrics/AbcSize

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<poll op="req"/>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -30,9 +30,9 @@
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'delete'}}
Delete
%h4 Keyrelay
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'keyrelay', epp_action: 'keyrelay'}}
Keyrelay
%h4 Poll
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'poll', epp_action: 'poll'}}
Poll
%h4 Contact
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'contact', epp_action: 'create'}}

View file

@ -913,3 +913,4 @@ en:
created_at_from: 'Created at from'
created_at_until: 'Created at until'
is_registrant: 'Is registrant'
force_delete_set_on_domain: 'Force delete set on domain %{domain}'

View file

@ -3096,5 +3096,12 @@ describe 'EPP Domain', epp: true do
name[:avail].should == '0'
reason.text.should == 'invalid format'
end
### POLL ###
it 'should show force delete in poll' do
domain.set_force_delete
response = epp_plain_request(@epp_xml.session.poll)
binding.pry
end
end
end

View file

@ -224,6 +224,10 @@ describe Domain do
fda = Time.zone.now + Setting.redemption_grace_period.days
@domain.force_delete_at.should be_within(20).of(fda)
@domain.registrar.messages.count.should == 1
m = @domain.registrar.messages.first
m.body.should == "Force delete set on domain #{@domain.name}"
@domain.unset_force_delete
@domain.statuses.should == ['ok']