From cb02ac4c93ff451b74d1b58072e5f030a8d7a4af Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 15:06:20 +0300 Subject: [PATCH 1/7] Fix renew restriction #2610 --- app/models/domain.rb | 2 +- db/schema.rb | 2 +- spec/epp/domain_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 84946b3e1..16d96bb09 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -245,7 +245,7 @@ class Domain < ActiveRecord::Base def renewable? if Setting.days_to_renew_domain_before_expire != 0 - if (valid_to - Time.zone.now).to_i / 1.day >= Setting.days_to_renew_domain_before_expire + if ((valid_to - Time.zone.now).to_i / 1.day) + 1 >= Setting.days_to_renew_domain_before_expire return false end end diff --git a/db/schema.rb b/db/schema.rb index 2f0849424..d395a7557 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150609103333) do +ActiveRecord::Schema.define(version: 20150610112238) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 89e60de00..2b4de33d5 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -1999,7 +1999,7 @@ describe 'EPP Domain', epp: true do end it 'does not renew a domain unless less than 90 days till expiration' do - domain.valid_to = Time.zone.now.to_date + 91.days + domain.valid_to = Time.zone.now.to_date + 90.days domain.save exp_date = domain.valid_to.to_date @@ -2013,7 +2013,7 @@ describe 'EPP Domain', epp: true do response[:results][0][:msg].should == 'Object is not eligible for renewal' response[:results][0][:result_code].should == '2105' - domain.valid_to = Time.zone.now.to_date + 90.days + domain.valid_to = Time.zone.now.to_date + 89.days domain.save exp_date = domain.valid_to.to_date From 3353dd74841d5363c265a52c6d6a5c0370a86ec7 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 15:17:13 +0300 Subject: [PATCH 2/7] Test fix #2610 --- app/models/domain.rb | 2 +- spec/epp/domain_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 16d96bb09..4490c1ad4 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -245,7 +245,7 @@ class Domain < ActiveRecord::Base def renewable? if Setting.days_to_renew_domain_before_expire != 0 - if ((valid_to - Time.zone.now).to_i / 1.day) + 1 >= Setting.days_to_renew_domain_before_expire + if ((valid_to - Time.zone.now.beginning_of_day).to_i / 1.day) + 1 >= Setting.days_to_renew_domain_before_expire return false end end diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 2b4de33d5..885d4324d 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -1999,7 +1999,8 @@ describe 'EPP Domain', epp: true do end it 'does not renew a domain unless less than 90 days till expiration' do - domain.valid_to = Time.zone.now.to_date + 90.days + # both days are inclusive + domain.valid_to = Time.zone.now.to_date + 89.days domain.save exp_date = domain.valid_to.to_date @@ -2013,7 +2014,7 @@ describe 'EPP Domain', epp: true do response[:results][0][:msg].should == 'Object is not eligible for renewal' response[:results][0][:result_code].should == '2105' - domain.valid_to = Time.zone.now.to_date + 89.days + domain.valid_to = Time.zone.now.to_date + 88.days domain.save exp_date = domain.valid_to.to_date From 2af47921f2241563e98a2194ef1d5db313c14b61 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 15:23:38 +0300 Subject: [PATCH 3/7] Fix #2610 --- app/models/domain.rb | 2 +- spec/epp/domain_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 4490c1ad4..6bb686132 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -245,7 +245,7 @@ class Domain < ActiveRecord::Base def renewable? if Setting.days_to_renew_domain_before_expire != 0 - if ((valid_to - Time.zone.now.beginning_of_day).to_i / 1.day) + 1 >= Setting.days_to_renew_domain_before_expire + if ((valid_to - Time.zone.now.beginning_of_day).to_i / 1.day) + 1 > Setting.days_to_renew_domain_before_expire return false end end diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 885d4324d..30cbed551 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2000,7 +2000,7 @@ describe 'EPP Domain', epp: true do it 'does not renew a domain unless less than 90 days till expiration' do # both days are inclusive - domain.valid_to = Time.zone.now.to_date + 89.days + domain.valid_to = Time.zone.now.to_date + 90.days domain.save exp_date = domain.valid_to.to_date @@ -2014,7 +2014,7 @@ describe 'EPP Domain', epp: true do response[:results][0][:msg].should == 'Object is not eligible for renewal' response[:results][0][:result_code].should == '2105' - domain.valid_to = Time.zone.now.to_date + 88.days + domain.valid_to = Time.zone.now.to_date + 89.days domain.save exp_date = domain.valid_to.to_date From 1e23641e01e5d491857b779c668e0744a8cf8848 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 15:38:06 +0300 Subject: [PATCH 4/7] Remove OK status on expire #2622 --- app/models/domain.rb | 12 ++++++++++-- spec/epp/domain_spec.rb | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 6bb686132..f20ad568a 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -152,7 +152,10 @@ class Domain < ActiveRecord::Base d = Domain.where('valid_to <= ?', Time.zone.now) d.each do |x| - x.domain_statuses.create(value: DomainStatus::EXPIRED) if x.expirable? + next unless x.expirable? + x.domain_statuses.create(value: DomainStatus::EXPIRED) + # TODO: This should be managed by automatic_statuses + x.domain_statuses.where(value: DomainStatus::OK).destroy_all end STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test? @@ -163,7 +166,10 @@ class Domain < ActiveRecord::Base d = Domain.where('outzone_at <= ?', Time.zone.now) d.each do |x| - x.domain_statuses.create(value: DomainStatus::SERVER_HOLD) if x.server_holdable? + next unless x.server_holdable? + x.domain_statuses.create(value: DomainStatus::SERVER_HOLD) + # TODO: This should be managed by automatic_statuses + x.domain_statuses.where(value: DomainStatus::OK).destroy_all end STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test? @@ -175,6 +181,8 @@ class Domain < ActiveRecord::Base d = Domain.where('delete_at <= ?', Time.zone.now) d.each do |x| x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable? + # TODO: This should be managed by automatic_statuses + x.domain_statuses.where(value: DomainStatus::OK).destroy_all end return if Rails.env.test? diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 30cbed551..83f428a34 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2078,6 +2078,7 @@ describe 'EPP Domain', epp: true do domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1 domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 1 + domain.domain_statuses.where(value: DomainStatus::OK).count.should == 0 exp_date = domain.valid_to.to_date @@ -2093,6 +2094,7 @@ describe 'EPP Domain', epp: true do domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 0 domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0 + domain.domain_statuses.where(value: DomainStatus::OK).count.should == 1 end it 'does not renew foreign domain' do From 9bd832278c65ff4f45fe47dd21be0d4ce805aab9 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 16:28:09 +0300 Subject: [PATCH 5/7] Extend outzone_at and delete_at also on domain renew #2622 --- app/models/domain.rb | 8 ++++++++ app/models/epp/domain.rb | 2 ++ spec/epp/domain_spec.rb | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index f20ad568a..0c7b1f3b1 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -410,6 +410,14 @@ class Domain < ActiveRecord::Base def manage_automatic_statuses # domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable? + # if domain_statuses.exists?(value: DomainStatus::FORCE_DELETE) + # domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).first_or_create + # domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).first_or_create + # domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).first_or_create + # domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).first_or_create + # domain_statuses.where(value: DomainStatus::PENDING_DELETE).first_or_create + # end + if domain_statuses.empty? && valid? domain_statuses.create(value: DomainStatus::OK) elsif domain_statuses.length > 1 || !valid? diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 407d100e3..4e7dc7f62 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -434,6 +434,8 @@ class Epp::Domain < Domain p = self.class.convert_period_to_time(period, unit) self.valid_to = valid_to + p + self.outzone_at = outzone_at + p + self.delete_at = delete_at + p self.period = period self.period_unit = unit diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 83f428a34..da1653e78 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -2070,7 +2070,10 @@ describe 'EPP Domain', epp: true do it 'should renew a expired domain' do domain.valid_to = Time.zone.now - 50.days + new_valid_to = domain.valid_to + 1.year domain.outzone_at = Time.zone.now - 50.days + new_outzone_at = domain.outzone_at + 1.year + new_delete_at = domain.delete_at + 1.year domain.save Domain.start_expire_period @@ -2095,6 +2098,11 @@ describe 'EPP Domain', epp: true do domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 0 domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0 domain.domain_statuses.where(value: DomainStatus::OK).count.should == 1 + + domain.reload + domain.valid_to.should be_within(5).of(new_valid_to) + domain.outzone_at.should be_within(5).of(new_outzone_at) + domain.delete_at.should be_within(5).of(new_delete_at) end it 'does not renew foreign domain' do From ba5be7b4f4d15fb9ada48e24d15509dd13eb6111 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 19:15:40 +0300 Subject: [PATCH 6/7] Add actions to set force delete #2624 --- app/controllers/admin/domains_controller.rb | 18 ++++++++ app/models/domain.rb | 44 +++++++++++++++---- app/models/domain_status.rb | 22 +++++----- app/views/admin/domains/show.haml | 5 +++ config/locales/en.yml | 2 + config/routes.rb | 4 ++ ...610144547_add_force_delete_at_to_domain.rb | 5 +++ db/schema.rb | 3 +- spec/models/domain_spec.rb | 22 ++++++++-- 9 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 db/migrate/20150610144547_add_force_delete_at_to_domain.rb diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 8c9e114b9..4b8820fd8 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -28,6 +28,24 @@ class Admin::DomainsController < AdminController end end + def set_force_delete + if @domain.set_force_delete + flash[:notice] = I18n.t('domain_updated') + else + flash.now[:alert] = I18n.t('failed_to_update_domain') + end + redirect_to [:admin, @domain] + end + + def unset_force_delete + if @domain.unset_force_delete + flash[:notice] = I18n.t('domain_updated') + else + flash.now[:alert] = I18n.t('failed_to_update_domain') + end + redirect_to [:admin, @domain] + end + private def set_domain diff --git a/app/models/domain.rb b/app/models/domain.rb index 0c7b1f3b1..db2f50f2c 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -198,6 +198,11 @@ class Domain < ActiveRecord::Base c += 1 end + Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| + x.destroy + c += 1 + end + STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test? end end @@ -306,6 +311,10 @@ class Domain < ActiveRecord::Base true end + def force_deletable? + domain_statuses.where(value: DomainStatus::FORCE_DELETE).empty? + end + def registrant_verification_asked? registrant_verification_asked_at.present? && registrant_verification_token.present? end @@ -407,17 +416,34 @@ class Domain < ActiveRecord::Base self.delete_at = outzone_at + Setting.redemption_grace_period.days end + def set_force_delete + domain_statuses.where(value: DomainStatus::FORCE_DELETE).first_or_create + domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).first_or_create + domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).first_or_create + domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).first_or_create + domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).first_or_create + domain_statuses.where(value: DomainStatus::PENDING_DELETE).first_or_create + domain_statuses.where(value: DomainStatus::CLIENT_DELETE_PROHIBITED).destroy_all + domain_statuses.where(value: DomainStatus::SERVER_DELETE_PROHIBITED).destroy_all + domain_statuses.reload + self.force_delete_at = Time.zone.now + Setting.redemption_grace_period unless self.force_delete_at + save(validate: false) + end + + def unset_force_delete + domain_statuses.where(value: DomainStatus::FORCE_DELETE).destroy_all + domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).destroy_all + domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).destroy_all + domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).destroy_all + domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).destroy_all + domain_statuses.where(value: DomainStatus::PENDING_DELETE).destroy_all + domain_statuses.reload + self.force_delete_at = nil + save(validate: false) + end + def manage_automatic_statuses # domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable? - - # if domain_statuses.exists?(value: DomainStatus::FORCE_DELETE) - # domain_statuses.where(value: DomainStatus::SERVER_RENEW_PROHIBITED).first_or_create - # domain_statuses.where(value: DomainStatus::SERVER_TRANSFER_PROHIBITED).first_or_create - # domain_statuses.where(value: DomainStatus::SERVER_UPDATE_PROHIBITED).first_or_create - # domain_statuses.where(value: DomainStatus::SERVER_MANUAL_INZONE).first_or_create - # domain_statuses.where(value: DomainStatus::PENDING_DELETE).first_or_create - # end - if domain_statuses.empty? && valid? domain_statuses.create(value: DomainStatus::OK) elsif domain_statuses.length > 1 || !valid? diff --git a/app/models/domain_status.rb b/app/models/domain_status.rb index 5a435ecc4..f27f0bb71 100644 --- a/app/models/domain_status.rb +++ b/app/models/domain_status.rb @@ -73,23 +73,23 @@ class DomainStatus < ActiveRecord::Base EXPIRED = 'expired' STATUSES = [ - CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD, - CLIENT_RENEW_PROHIBITED, SERVER_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, - SERVER_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED, SERVER_UPDATE_PROHIBITED, - INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_RENEW, PENDING_TRANSFER, - PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, - SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE, + CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD, + CLIENT_RENEW_PROHIBITED, SERVER_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, + SERVER_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED, SERVER_UPDATE_PROHIBITED, + INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_RENEW, PENDING_TRANSFER, + PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, + SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE, DELETE_CANDIDATE, EXPIRED ] - + CLIENT_STATUSES = [ - CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, + CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED ] - + SERVER_STATUSES = [ SERVER_DELETE_PROHIBITED, SERVER_HOLD, SERVER_RENEW_PROHIBITED, SERVER_TRANSFER_PROHIBITED, - SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, + SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED ] @@ -113,7 +113,7 @@ class DomainStatus < ActiveRecord::Base case value when 'ok' 'ok (paid and in zone)' - else + else value end end diff --git a/app/views/admin/domains/show.haml b/app/views/admin/domains/show.haml index ccff3e1ed..be4e37614 100644 --- a/app/views/admin/domains/show.haml +++ b/app/views/admin/domains/show.haml @@ -1,6 +1,11 @@ - content_for :actions do = link_to(t(:edit_statuses), edit_admin_domain_path(@domain), class: 'btn btn-primary') = link_to(t(:history), admin_domain_domain_versions_path(@domain.id), method: :get, class: 'btn btn-primary') + - if @domain.force_deletable? + = link_to(t(:set_force_delete), set_force_delete_admin_domain_path(@domain), method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning') + - else + = link_to(t(:unset_force_delete), unset_force_delete_admin_domain_path(@domain), method: :post, data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning') + = render 'shared/title', name: @domain.name .row diff --git a/config/locales/en.yml b/config/locales/en.yml index 5efa0fbb2..968b86e79 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -818,3 +818,5 @@ en: valid: Valid category: Zone object_is_not_eligible_for_renewal: 'Object is not eligible for renewal' + set_force_delete: 'Set force delete' + unset_force_delete: 'Unset force delete' diff --git a/config/routes.rb b/config/routes.rb index f0b0dabeb..5a686aca5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -175,6 +175,10 @@ Rails.application.routes.draw do resources :domains do resources :domain_versions + member do + post 'set_force_delete' + post 'unset_force_delete' + end end resources :settings diff --git a/db/migrate/20150610144547_add_force_delete_at_to_domain.rb b/db/migrate/20150610144547_add_force_delete_at_to_domain.rb new file mode 100644 index 000000000..547d928a8 --- /dev/null +++ b/db/migrate/20150610144547_add_force_delete_at_to_domain.rb @@ -0,0 +1,5 @@ +class AddForceDeleteAtToDomain < ActiveRecord::Migration + def change + add_column :domains, :force_delete_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index d395a7557..ec005e0c4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150610112238) do +ActiveRecord::Schema.define(version: 20150610144547) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -306,6 +306,7 @@ ActiveRecord::Schema.define(version: 20150610112238) do t.datetime "registrant_verification_asked_at" t.string "registrant_verification_token" t.json "pending_json" + t.datetime "force_delete_at" end add_index "domains", ["delete_at"], name: "index_domains_on_delete_at", using: :btree diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index ba9066e86..bb2a5e23f 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -143,16 +143,32 @@ describe Domain do end it 'should destroy delete candidates' do - Fabricate(:domain) - Domain.count.should == 2 + d = Fabricate(:domain) + d.force_delete_at = Time.zone.now + d.save @domain.delete_at = Time.zone.now @domain.save + Domain.count.should == 2 + Domain.start_delete_period Domain.destroy_delete_candidates - Domain.count.should == 1 + Domain.count.should == 0 + end + + it 'should set force delete time' do + @domain.set_force_delete + + @domain.domain_statuses.count.should == 6 + fda = Time.zone.now + Setting.redemption_grace_period + @domain.force_delete_at.should be_within(20).of(fda) + + @domain.unset_force_delete + + @domain.domain_statuses.count.should == 1 + @domain.force_delete_at.should be_nil end context 'about registrant update confirm' do From fd1d8bc26156c9ca93a82e14ea797205f40819d4 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 19:39:21 +0300 Subject: [PATCH 7/7] Fix seconds to days #2624 --- app/models/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index db2f50f2c..e650b118d 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -426,7 +426,7 @@ class Domain < ActiveRecord::Base domain_statuses.where(value: DomainStatus::CLIENT_DELETE_PROHIBITED).destroy_all domain_statuses.where(value: DomainStatus::SERVER_DELETE_PROHIBITED).destroy_all domain_statuses.reload - self.force_delete_at = Time.zone.now + Setting.redemption_grace_period unless self.force_delete_at + self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless self.force_delete_at save(validate: false) end