mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 05:56:20 +02:00
Merge pull request #2504 from internetee/2503-invalid-disputed-statuses-on-domains-that-were-disputed-in-the-past
added cleaner for disputed domains with the closed disputed
This commit is contained in:
commit
dc4094ecda
2 changed files with 30 additions and 0 deletions
|
@ -8,6 +8,7 @@ class DisputeStatusUpdateJob < ApplicationJob
|
||||||
|
|
||||||
close_disputes
|
close_disputes
|
||||||
activate_disputes
|
activate_disputes
|
||||||
|
clean_disputed
|
||||||
|
|
||||||
@logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \
|
@logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \
|
||||||
"activated #{@backlog['activated']} disputes."
|
"activated #{@backlog['activated']} disputes."
|
||||||
|
@ -15,6 +16,13 @@ class DisputeStatusUpdateJob < ApplicationJob
|
||||||
show_failed_disputes unless @backlog['activate_fail'].empty? && @backlog['close_fail'].empty?
|
show_failed_disputes unless @backlog['activate_fail'].empty? && @backlog['close_fail'].empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clean_disputed
|
||||||
|
domains = Domain.where("array_to_string(statuses, '||') ILIKE ?", '%disputed%')
|
||||||
|
domains.each do |domain|
|
||||||
|
domain.unmark_as_disputed unless domain.disputed?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def close_disputes
|
def close_disputes
|
||||||
disputes = if @include_closed
|
disputes = if @include_closed
|
||||||
Dispute.where('expires_at < ?', Time.zone.today).all
|
Dispute.where('expires_at < ?', Time.zone.today).all
|
||||||
|
|
|
@ -73,4 +73,26 @@ class DisputeStatusUpdateJobTest < ActiveJob::TestCase
|
||||||
whois_record.reload
|
whois_record.reload
|
||||||
assert_not whois_record.json['status'].include? 'disputed'
|
assert_not whois_record.json['status'].include? 'disputed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_close_dispute_with_domains_with_dispute_status
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
|
domain = domains(:shop)
|
||||||
|
domain.statuses << DomainStatus::DISPUTED
|
||||||
|
domain.save && domain.reload
|
||||||
|
|
||||||
|
dispute = disputes(:closed)
|
||||||
|
dispute.domain_name = domain.name
|
||||||
|
dispute.save && dispute.reload
|
||||||
|
|
||||||
|
assert domain.statuses.include? DomainStatus::DISPUTED
|
||||||
|
|
||||||
|
perform_enqueued_jobs do
|
||||||
|
DisputeStatusUpdateJob.perform_now
|
||||||
|
end
|
||||||
|
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
refute domain.statuses.include? DomainStatus::DISPUTED
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue