From 9ceeb06882cea5856660168824259afac0ccff39 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 14:19:49 +0300 Subject: [PATCH 1/4] Log to stdout #2623 --- app/models/domain.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 09e4c875d..84946b3e1 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -148,40 +148,41 @@ class Domain < ActiveRecord::Base end def start_expire_period - logger.info "#{Time.zone.now.utc} - Expiring domains\n" + STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test? d = Domain.where('valid_to <= ?', Time.zone.now) d.each do |x| x.domain_statuses.create(value: DomainStatus::EXPIRED) if x.expirable? end - logger.info "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" + STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test? end def start_redemption_grace_period - logger.info "#{Time.zone.now.utc} - Setting server_hold to domains\n" + STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test? d = Domain.where('outzone_at <= ?', Time.zone.now) d.each do |x| x.domain_statuses.create(value: DomainStatus::SERVER_HOLD) if x.server_holdable? end - logger.info "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" + STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test? end def start_delete_period - logger.info "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" + STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test? d = Domain.where('delete_at <= ?', Time.zone.now) d.each do |x| x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable? end - logger.info "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n" + return if Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n" end def destroy_delete_candidates - logger.info "#{Time.zone.now.utc} - Destroying domains\n" + STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test? c = 0 DomainStatus.where(value: DomainStatus::DELETE_CANDIDATE).each do |x| @@ -189,7 +190,7 @@ class Domain < ActiveRecord::Base c += 1 end - logger.info "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" + STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test? end end From 4d51a8e575cac93970a7ea4e30cd0ce232a35849 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 10 Jun 2015 14:20:09 +0300 Subject: [PATCH 2/4] Registrar ident update #2618 --- .../contacts/form_partials/_general.haml | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/app/views/registrar/contacts/form_partials/_general.haml b/app/views/registrar/contacts/form_partials/_general.haml index 623d27c18..14037f05b 100644 --- a/app/views/registrar/contacts/form_partials/_general.haml +++ b/app/views/registrar/contacts/form_partials/_general.haml @@ -1,29 +1,30 @@ -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:ident) - .panel-body - .form-group - .col-md-3.control-label - = f.label :ident_country_code, t(:country) + '*' - .col-md-7 - = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, - class: 'js-ident-country-code', required: true) +- if !@contact.persisted? + .panel.panel-default + .panel-heading.clearfix + .pull-left= t(:ident) + .panel-body + .form-group + .col-md-3.control-label + = f.label :ident_country_code, t(:country) + '*' + .col-md-7 + = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, + class: 'js-ident-country-code', required: true) - .form-group - .col-md-3.control-label - = f.label :ident_type, t(:type) + '*' - .col-md-7 - = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, - class: 'js-ident-type', required: true) + .form-group + .col-md-3.control-label + = f.label :ident_type, t(:type) + '*' + .col-md-7 + = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, + class: 'js-ident-type', required: true) - .form-group - .col-md-3.control-label - = f.label :ident, t(:ident) + '*' - .col-md-7 - = f.text_field :ident, class: 'form-control', required: true - - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' - .js-ident-tip{ style: tip_visibility } - = t(:birthday_format) + .form-group + .col-md-3.control-label + = f.label :ident, t(:ident) + '*' + .col-md-7 + = f.text_field :ident, class: 'form-control', required: true + - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' + .js-ident-tip{ style: tip_visibility } + = t(:birthday_format) .panel.panel-default .panel-heading.clearfix From 8ae7adcc9cf81032c1947fc8c54730755f796edc Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 14:28:21 +0300 Subject: [PATCH 3/4] Add outzone and delete columns #2622 --- ...20150610112238_add_outzone_at_and_delete_at_to_domain.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 db/migrate/20150610112238_add_outzone_at_and_delete_at_to_domain.rb diff --git a/db/migrate/20150610112238_add_outzone_at_and_delete_at_to_domain.rb b/db/migrate/20150610112238_add_outzone_at_and_delete_at_to_domain.rb new file mode 100644 index 000000000..6b555b2a3 --- /dev/null +++ b/db/migrate/20150610112238_add_outzone_at_and_delete_at_to_domain.rb @@ -0,0 +1,6 @@ +class AddOutzoneAtAndDeleteAtToDomain < ActiveRecord::Migration + def change + add_column :domains, :outzone_at, :datetime unless column_exists?(:domains, :outzone_at) + add_column :domains, :delete_at, :datetime unless column_exists?(:domains, :delete_at) + end +end From 3822cef0b637c54c9622b77ea603123f96312625 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 10 Jun 2015 14:31:01 +0300 Subject: [PATCH 4/4] Registrar ident disabled #2618 --- app/models/depp/contact.rb | 2 +- .../contacts/form_partials/_general.haml | 49 +++++++++---------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb index 5233525d8..063fa0f1f 100644 --- a/app/models/depp/contact.rb +++ b/app/models/depp/contact.rb @@ -230,7 +230,7 @@ module Depp def extension_xml xml = { _anonymus: [] } - ident = ident_xml[:_anonymus].try(:first) + ident = ident_xml[:_anonymus].try(:first) if !persisted? legal = legal_document_xml[:_anonymus].try(:first) xml[:_anonymus] << ident if ident.present? xml[:_anonymus] << legal if legal.present? diff --git a/app/views/registrar/contacts/form_partials/_general.haml b/app/views/registrar/contacts/form_partials/_general.haml index 14037f05b..9e243103a 100644 --- a/app/views/registrar/contacts/form_partials/_general.haml +++ b/app/views/registrar/contacts/form_partials/_general.haml @@ -1,30 +1,29 @@ -- if !@contact.persisted? - .panel.panel-default - .panel-heading.clearfix - .pull-left= t(:ident) - .panel-body - .form-group - .col-md-3.control-label - = f.label :ident_country_code, t(:country) + '*' - .col-md-7 - = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, - class: 'js-ident-country-code', required: true) +.panel.panel-default + .panel-heading.clearfix + .pull-left= t(:ident) + .panel-body + .form-group + .col-md-3.control-label + = f.label :ident_country_code, t(:country) + '*' + .col-md-7 + = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, + class: 'js-ident-country-code', required: true, disabled: @contact.persisted?) - .form-group - .col-md-3.control-label - = f.label :ident_type, t(:type) + '*' - .col-md-7 - = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, - class: 'js-ident-type', required: true) + .form-group + .col-md-3.control-label + = f.label :ident_type, t(:type) + '*' + .col-md-7 + = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, + class: 'js-ident-type', required: true, disabled: @contact.persisted?) - .form-group - .col-md-3.control-label - = f.label :ident, t(:ident) + '*' - .col-md-7 - = f.text_field :ident, class: 'form-control', required: true - - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' - .js-ident-tip{ style: tip_visibility } - = t(:birthday_format) + .form-group + .col-md-3.control-label + = f.label :ident, t(:ident) + '*' + .col-md-7 + = f.text_field :ident, class: 'form-control', required: true, disabled: @contact.persisted? + - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' + .js-ident-tip{ style: tip_visibility } + = t(:birthday_format) .panel.panel-default .panel-heading.clearfix