Skip to content

Commit

Permalink
Merge branch 'master' into fix-statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
maricavor authored Dec 13, 2022
2 parents 7c84949 + e971638 commit 6c37490
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
services:
postgres:
image: postgres:14
image: postgres:15
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: password
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
07.12.2022
* return contact detaisl with authinfo pw of linked domain https://github.com/internetee/registry/issues/2492
* fixed disputed status removal https://github.com/internetee/registry/issues/2503

06.12.2022
* save status notes to domain history https://github.com/internetee/registry/issues/2484
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ gem 'uglifier'
gem 'figaro', '~> 1.2'

# model related
gem 'paper_trail', '~> 13.0'
gem 'paper_trail', '~> 14.0'
gem 'pg', '1.4.5'
# 1.8 is for Rails < 5.0
gem 'ransack', '~> 2.6.0'
gem 'truemail', '~> 2.4' # validates email by regexp, mail server existence and address existence
gem 'truemail', '~> 3.0' # validates email by regexp, mail server existence and address existence
gem 'validates_email_format_of', '1.7.2' # validates email against RFC 2822 and RFC 3696

# 0.7.3 is the latest for Rails 4.2, however, it is absent on Rubygems server
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ GEM
newrelic_rpm (= 8.1.0)
newrelic_rpm (8.1.0)
nio4r (2.5.8)
nokogiri (1.13.9)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.9-x86_64-linux)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
nori (2.6.0)
omniauth (2.1.0)
Expand All @@ -356,9 +356,9 @@ GEM
validate_url
webfinger (~> 1.2)
orm_adapter (0.5.0)
paper_trail (13.0.0)
activerecord (>= 5.2)
request_store (~> 1.1)
paper_trail (14.0.0)
activerecord (>= 6.0)
request_store (~> 1.4)
pdfkit (0.8.7.2)
pg (1.4.5)
pg_query (2.1.2)
Expand All @@ -371,7 +371,7 @@ GEM
public_suffix (5.0.0)
puma (5.6.4)
nio4r (~> 2.0)
racc (1.6.0)
racc (1.6.1)
rack (2.2.4)
rack-oauth2 (1.21.3)
activesupport
Expand Down Expand Up @@ -484,15 +484,15 @@ GEM
thor (1.2.1)
tilt (2.0.11)
timeout (0.3.0)
truemail (2.4.9)
truemail (3.0.3)
simpleidn (~> 0.2.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unf_ext (0.0.8.2)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
Expand Down Expand Up @@ -572,7 +572,7 @@ DEPENDENCIES
nokogiri (~> 1.13.0)
omniauth-rails_csrf_protection
omniauth-tara!
paper_trail (~> 13.0)
paper_trail (~> 14.0)
pdfkit
pg (= 1.4.5)
pg_query (>= 0.9.0)
Expand All @@ -591,7 +591,7 @@ DEPENDENCIES
simpleidn (= 0.2.1)
spy
strong_migrations
truemail (~> 2.4)
truemail (~> 3.0)
uglifier
validates_email_format_of (= 1.7.2)
webdrivers
Expand Down
8 changes: 8 additions & 0 deletions app/jobs/dispute_status_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ def perform(logger: Logger.new($stdout), include_closed: false)

close_disputes
activate_disputes
clean_disputed

@logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \
"activated #{@backlog['activated']} disputes."

show_failed_disputes unless @backlog['activate_fail'].empty? && @backlog['close_fail'].empty?
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
disputes = if @include_closed
Dispute.where('expires_at < ?', Time.zone.today).all
Expand Down
22 changes: 22 additions & 0 deletions test/jobs/dispute_status_update_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,26 @@ def test_registered_domain_whois_data_is_removed
whois_record.reload
assert_not whois_record.json['status'].include? 'disputed'
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

0 comments on commit 6c37490

Please sign in to comment.