Merge pull request #1700 from internetee/1664-remove-pendingDelete-status-if-domain-is-renewed-and-block-other-transform-operations

Renew: Cancel pendingDelete when domain is renewed
This commit is contained in:
Timo Võhmar 2020-10-28 15:12:06 +02:00 committed by GitHub
commit ab8789d36d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -320,8 +320,8 @@ class Domain < ApplicationRecord
def renew_blocking_statuses def renew_blocking_statuses
disallowed = [DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW, disallowed = [DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER, DomainStatus::CLIENT_RENEW_PROHIBITED, DomainStatus::PENDING_TRANSFER, DomainStatus::CLIENT_RENEW_PROHIBITED,
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE, DomainStatus::PENDING_UPDATE, DomainStatus::SERVER_RENEW_PROHIBITED,
DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::SERVER_RENEW_PROHIBITED] DomainStatus::PENDING_DELETE_CONFIRMATION]
(statuses & disallowed) (statuses & disallowed)
end end

View file

@ -612,6 +612,7 @@ class Epp::Domain < Domain
statuses.delete(DomainStatus::SERVER_HOLD) statuses.delete(DomainStatus::SERVER_HOLD)
statuses.delete(DomainStatus::EXPIRED) statuses.delete(DomainStatus::EXPIRED)
statuses.delete(DomainStatus::SERVER_UPDATE_PROHIBITED) statuses.delete(DomainStatus::SERVER_UPDATE_PROHIBITED)
cancel_pending_delete
save save
end end

View file

@ -444,6 +444,20 @@ class DomainTest < ActiveSupport::TestCase
assert_not @domain.renewable? assert_not @domain.renewable?
end end
def test_renewable_if_pending_delete
assert @domain.renewable?
@domain.statuses << DomainStatus::PENDING_DELETE
assert @domain.renewable?
end
def test_not_renewable_if_pending_delete_unconfirmed
assert @domain.renewable?
@domain.statuses << DomainStatus::PENDING_DELETE_CONFIRMATION
assert_not @domain.renewable?
end
private private
def valid_domain def valid_domain