mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Merge pull request #1707 from internetee/1705-removing-pendingUpdate-status-fails-if-domain-has-forceDelete-status-set
Domain: Don't respect forceDelete status when determining pending_update?
This commit is contained in:
commit
428054e401
3 changed files with 33 additions and 1 deletions
|
@ -489,7 +489,7 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def pending_update?
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE) && !statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
|
||||
# depricated not used, not valid
|
||||
|
|
|
@ -242,4 +242,14 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
|
|||
|
||||
assert_not_includes(@domain.statuses, asserted_status)
|
||||
end
|
||||
|
||||
def test_force_delete_does_not_affect_pending_update_check
|
||||
@domain.schedule_force_delete(type: :soft)
|
||||
@domain.reload
|
||||
|
||||
@domain.statuses << DomainStatus::PENDING_UPDATE
|
||||
|
||||
assert @domain.force_delete_scheduled?
|
||||
assert @domain.pending_update?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,4 +52,26 @@ class DomainCronTest < ActiveSupport::TestCase
|
|||
|
||||
assert_emails 0
|
||||
end
|
||||
|
||||
def test_cleans_expired_pendings_when_force_delete_active
|
||||
Setting.expire_pending_confirmation = 0
|
||||
|
||||
# Set force delete
|
||||
@domain.schedule_force_delete(type: :soft)
|
||||
@domain.reload
|
||||
|
||||
@domain.statuses << DomainStatus::PENDING_UPDATE
|
||||
# Set domain registrant change that's expired
|
||||
@domain.update!(registrant_verification_asked_at: Time.zone.now,
|
||||
registrant_verification_token: 'test',
|
||||
statuses: @domain.statuses)
|
||||
|
||||
assert @domain.pending_update?
|
||||
@domain.reload
|
||||
|
||||
DomainCron.clean_expired_pendings
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.pending_update?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue