From 73416869711b0465e82a487eafe80c01c5c82628 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 6 Dec 2015 23:34:14 +0200 Subject: [PATCH 001/247] 109361594-no_access_changed --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 098c10d9b..ccfefb1fb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,7 +27,7 @@ module ApplicationHelper if ident.present? "#{ident} [#{ident_country_code} #{ident_type}]" else - "[No access]" + "[Blank]" end end From 2fe026715a15fc8de739c6159db616b8061ac867 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 10 Dec 2015 11:17:48 +0200 Subject: [PATCH 002/247] 1088869472-methods_for_archive --- .../admin/domain_versions_controller.rb | 14 +-- app/controllers/admin/domains_controller.rb | 5 + .../admin/domains_versions_controller.rb | 7 ++ app/models/ability.rb | 1 + .../admin/domains/partials/_version.haml | 105 ++++++++++++++++++ app/views/admin/domains/versions.haml | 44 ++++++++ app/views/layouts/admin/application.haml | 4 + config/routes.rb | 14 ++- 8 files changed, 186 insertions(+), 8 deletions(-) create mode 100644 app/controllers/admin/domains_versions_controller.rb create mode 100644 app/views/admin/domains/partials/_version.haml create mode 100644 app/views/admin/domains/versions.haml diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 44a2087cd..35fffbaa2 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,10 +1,10 @@ -class Admin::DomainVersionsController < AdminController - load_and_authorize_resource +#class Admin::DomainVersionsController < AdminController + #load_and_authorize_resource # rubocop:disable Style/GuardClause - def index - @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first - @versions = @domain.versions + #def index + # @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first + # @versions = @domain.versions # Depricated it had to load legal document. We may do it by parsing and adding link. # if @domain.pending_json.present? @@ -13,6 +13,6 @@ class Admin::DomainVersionsController < AdminController # @pending_domain = Epp::Domain.find(@domain.id) # @pending_domain.update(frame, @pending_user, false) # end - end + #end # rubocop:enable Style/GuardClause -end + #end diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 377912bad..36bdefbff 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -77,6 +77,11 @@ class Admin::DomainsController < AdminController redirect_to [:admin, @domain] end + def versions + @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first + @versions = @domain.versions + end + private def set_domain diff --git a/app/controllers/admin/domains_versions_controller.rb b/app/controllers/admin/domains_versions_controller.rb new file mode 100644 index 000000000..505ebf2c1 --- /dev/null +++ b/app/controllers/admin/domains_versions_controller.rb @@ -0,0 +1,7 @@ +class Admin::DomainsVersionsController < AdminController + load_and_authorize_resource + + def index + + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index cf98cb704..07be0af7c 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -95,6 +95,7 @@ class Ability can :manage, ReservedDomain can :manage, ZonefileSetting can :manage, DomainVersion + can :manage, ContactVersion can :manage, Pricelist can :manage, User can :manage, ApiUser diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml new file mode 100644 index 000000000..fd449b4b0 --- /dev/null +++ b/app/views/admin/domains/partials/_version.haml @@ -0,0 +1,105 @@ +- statuses_link ||= false +- version ||= false +- domain ||= false +- pending_user ||= false + +- if domain.present? + - if version # normal history + - children = HashWithIndifferentAccess.new(version.children) + - nameservers = Nameserver.where(id: children[:nameservers]) + - tech_contacts = Contact.where(id: children[:tech_contacts]) + - admin_contacts = Contact.where(id: children[:admin_contacts]) + - registrant = Contact.where(id: children[:registrant]) + - event = version.event + - creator = plain_username(version.terminator) + - else # pending history + - nameservers = domain.nameservers + - tech_contacts = domain.tech_contacts + - admin_contacts = domain.admin_contacts + - registrant = [domain.registrant] + - creator = pending_user.try(:username) + - event = 'pending' + + %td + %p.nowrap + = l(domain.updated_at, format: :shorts) + - if statuses_link + %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) + + %p.text-right + = event + %br + = creator + + %td + %p + - if domain.statuses.present? + - domain.statuses.each do |s| + = s + - if domain.status_notes.present? + - notes = domain.status_notes[s] + - if notes + %br + %i= notes + %br + - if domain.pending_json.present? + %p + = link_to t(:pending_epp), '#', class: 'js-pending-toggle' + + %td + %p + = "#{domain.period}#{domain.period_unit}" + %br + = "#{l(domain.valid_from, format: :date)}" + %br + = "#{l(domain.valid_to, format: :date)}" + + %td + - registrant.each do |r| + %p + = r[:name] + = r[:phone] + = r[:email] + %p + = r[:code] + + %td + - admin_contacts.each do |ac| + %p + = ac[:name] + = ac[:phone] + = ac[:email] + %p + = ac[:code] + + %td + - tech_contacts.each do |tc| + %p + = tc[:name] + = tc[:phone] + = tc[:email] + %p + = tc[:code] + + %td + %p + - nameservers.each do |ns| + = ns[:hostname] + %br + = ns[:ipv4] + = ns[:ipv6] + + %td + %p + = domain.registrar.name + + - if domain.pending_json.present? + %tr.js-pending{ style: 'display: none;' } + %td{colspan: 8} + = preserve do + %pre + - formatted_req = Nokogiri::XML(domain.pending_json['frame']) + - if formatted_req.errors.none? + = formatted_req + - else + = domain.pending_json['frame'] diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml new file mode 100644 index 000000000..5224aa34a --- /dev/null +++ b/app/views/admin/domains/versions.haml @@ -0,0 +1,44 @@ +- content_for :actions do + = link_to(t(:back_to_domain), [:admin, @domain], class: 'btn btn-default') += render 'shared/title', name: "#{t(:history)}: #{@domain.name}" + +.row + .col-md-12 + .table-responsive + %table.table-hover.table-bordered.table-condensed + %thead + %tr + %th{class: 'col-xs-1'}= t(:timestap) + %th{class: 'col-xs-2'}= t(:statuses) + %th{class: 'col-xs-1'}= t(:period) + %th{class: 'col-xs-2'}= t(:registrant) + %th{class: 'col-xs-2'}= t(:admin) + %th{class: 'col-xs-2'}= t(:tech) + %th{class: 'col-xs-2'}= t(:nameservers) + %th{class: 'col-xs-2'}= t(:registrar) + + %tbody + - if @pending_domain.present? + %tr.small + = render 'admin/domains/partials/version', + domain: @pending_domain, pending_user: @pending_user, statuses_link: true + + -# current version + - if @domain.versions.present? + %tr.small + = render 'admin/domains/partials/version', + domain: @domain, version: @domain.versions.last + + -# all other older versions + - @domain.versions.not_creates.reverse.each do |version| + %tr.small + = render 'admin/domains/partials/version', + domain: version.reify, version: version.previous + +:coffee + $(document).on 'click', '.js-pending-toggle', (e) -> + e.preventDefault() + + $(document).on 'mousedown', '.js-pending-toggle', (e) -> + target = $(e.target) + target.parents('tr').next('tr.js-pending').toggle() diff --git a/app/views/layouts/admin/application.haml b/app/views/layouts/admin/application.haml index 6e3257740..a4481d6e6 100644 --- a/app/views/layouts/admin/application.haml +++ b/app/views/layouts/admin/application.haml @@ -57,6 +57,10 @@ %li= link_to t(:invoices), admin_invoices_path %li= link_to t(:account_activities), admin_account_activities_path %li.divider + %li.dropdown-header= t(:archive) + %li= link_to t(:domains_history), admin_domains_versions_path + %li= link_to t(:contacts_history), admin_contacts_versions_path + %li.divider %li.dropdown-header= t(:system) %li= link_to t(:settings), admin_settings_path %li= link_to t(:zonefile), admin_zonefile_settings_path diff --git a/config/routes.rb b/config/routes.rb index c1cc98697..7a5f6cb2a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -192,7 +192,7 @@ Rails.application.routes.draw do end resources :domains do - resources :domain_versions + resources :domain_versions, controller: 'domains', action: 'versions' resources :pending_updates resources :pending_deletes member do @@ -201,6 +201,18 @@ Rails.application.routes.draw do end end + resources :domains_versions do + collection do + get 'search' + end + end + + resources :contacts_versions do + collection do + get 'search' + end + end + resources :settings resources :blocked_domains From dbe414db6fc39a9e5708358c041274cada84260b Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 10 Dec 2015 12:13:25 +0200 Subject: [PATCH 003/247] 109361594-cutted_ident_added --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ccfefb1fb..2d14dd3d2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,7 +27,7 @@ module ApplicationHelper if ident.present? "#{ident} [#{ident_country_code} #{ident_type}]" else - "[Blank]" + "[#{ident_country_code} #{ident_type}]" end end From 2ff64fe382e74e72811ef87e4c54a15cf5fc746f Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 10 Dec 2015 15:22:54 +0200 Subject: [PATCH 004/247] 109361594-ident_country_added --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2d14dd3d2..97b3ad621 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -22,7 +22,7 @@ module ApplicationHelper case ident_type when 'birthday' - "#{ident} [#{ident_type}]" + "#{ident} [#{ident_country_code} #{ident_type}]" else if ident.present? "#{ident} [#{ident_country_code} #{ident_type}]" From f1425398277c501b869490445eb38fb53be7120d Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 11 Dec 2015 10:58:33 +0200 Subject: [PATCH 005/247] 108869472-templates --- .../admin/contact_versions_controller.rb | 39 ++++++++++++++++++ .../admin/domain_versions_controller.rb | 10 ++--- .../admin/domains_versions_controller.rb | 7 ---- app/views/admin/contact_versions/index.haml | 40 +++++++++++++++++++ app/views/layouts/admin/application.haml | 4 +- config/routes.rb | 4 +- 6 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 app/controllers/admin/contact_versions_controller.rb delete mode 100644 app/controllers/admin/domains_versions_controller.rb create mode 100644 app/views/admin/contact_versions/index.haml diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb new file mode 100644 index 000000000..cd49011a0 --- /dev/null +++ b/app/controllers/admin/contact_versions_controller.rb @@ -0,0 +1,39 @@ +class Admin::ContactVersionsController < AdminController + load_and_authorize_resource + + def index + params[:q] ||= {} + @q = ContactVersion.search(params[:q]) + @versions = @q.result.page(params[:page]) + + versions = ContactVersion.all + + normalize_search_parameters do + @q = versions.search(params[:q]) + @versions = @q.result.page(params[:page]) + end + + @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + end + + def search + render json: ContactVersion.search_by_query(params[:q]) + end + + def normalize_search_parameters + ca_cache = params[:q][:created_at_lteq] + begin + end_time = params[:q][:created_at_lteq].try(:to_date) + params[:q][:created_at_lteq] = end_time.try(:end_of_day) + end_time = params[:q][:updated_at_gteq].try(:to_date) + params[:q][:updated_at_lteq] = end_time.try(:end_of_day) + rescue + logger.warn('Invalid date') + end + + yield + + params[:q][:created_at_lteq] = ca_cache + end + +end diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 35fffbaa2..985c680f9 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,8 +1,8 @@ -#class Admin::DomainVersionsController < AdminController - #load_and_authorize_resource +class Admin::DomainVersionsController < AdminController + load_and_authorize_resource # rubocop:disable Style/GuardClause - #def index + def index # @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first # @versions = @domain.versions @@ -13,6 +13,6 @@ # @pending_domain = Epp::Domain.find(@domain.id) # @pending_domain.update(frame, @pending_user, false) # end - #end + end # rubocop:enable Style/GuardClause - #end + end diff --git a/app/controllers/admin/domains_versions_controller.rb b/app/controllers/admin/domains_versions_controller.rb deleted file mode 100644 index 505ebf2c1..000000000 --- a/app/controllers/admin/domains_versions_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Admin::DomainsVersionsController < AdminController - load_and_authorize_resource - - def index - - end -end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml new file mode 100644 index 000000000..e86b56e5b --- /dev/null +++ b/app/views/admin/contact_versions/index.haml @@ -0,0 +1,40 @@ += render 'shared/title', name: t(:contact_versions) + + +%hr +.row + .col-md-12 + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th{class: 'col-xs-2'} + = sort_link(@q, 'name', t(:ID)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'code', t(:item_id)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'ident', t(:event)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'email', t(:object)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'registrar_name', t(:registrar)) + %tbody + - @versions.each do |version| + %tr + %td= 1 + %td= 2 + %td= 3 + %td= 4 + %td= 5 + +.row + .col-md-6 + = paginate @versions + .col-md-6.text-right + .pagination + = t(:result_count, count: @contacts.total_count) + +:coffee + $(".js-reset-form").on "click", (e) -> + e.preventDefault(); + window.location = "#{admin_contact_versions_path}" diff --git a/app/views/layouts/admin/application.haml b/app/views/layouts/admin/application.haml index a4481d6e6..6baef9abf 100644 --- a/app/views/layouts/admin/application.haml +++ b/app/views/layouts/admin/application.haml @@ -58,8 +58,8 @@ %li= link_to t(:account_activities), admin_account_activities_path %li.divider %li.dropdown-header= t(:archive) - %li= link_to t(:domains_history), admin_domains_versions_path - %li= link_to t(:contacts_history), admin_contacts_versions_path + %li= link_to t(:domains_history), admin_domain_versions_path + %li= link_to t(:contacts_history), admin_contact_versions_path %li.divider %li.dropdown-header= t(:system) %li= link_to t(:settings), admin_settings_path diff --git a/config/routes.rb b/config/routes.rb index 7a5f6cb2a..2dfc608cd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -201,13 +201,13 @@ Rails.application.routes.draw do end end - resources :domains_versions do + resources :domain_versions do collection do get 'search' end end - resources :contacts_versions do + resources :contact_versions do collection do get 'search' end From a8ff88771770eaad6b7e44592b3921a3fd0c2e36 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 7 Jan 2016 13:07:06 +0200 Subject: [PATCH 006/247] 108869472-template_changes --- app/views/admin/contact_versions/index.haml | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index e86b56e5b..195b90783 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -1,7 +1,6 @@ = render 'shared/title', name: t(:contact_versions) -%hr .row .col-md-12 .table-responsive @@ -9,30 +8,35 @@ %thead %tr %th{class: 'col-xs-2'} - = sort_link(@q, 'name', t(:ID)) + = sort_link(@q, 'name', t(:name)) %th{class: 'col-xs-2'} - = sort_link(@q, 'code', t(:item_id)) + = sort_link(@q, 'code', t(:id)) %th{class: 'col-xs-2'} - = sort_link(@q, 'ident', t(:event)) - %th{class: 'col-xs-2'} - = sort_link(@q, 'email', t(:object)) + = sort_link(@q, 'ident', t(:ident)) %th{class: 'col-xs-2'} = sort_link(@q, 'registrar_name', t(:registrar)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'email', t(:created_at)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'action', t(:action)) %tbody - @versions.each do |version| %tr - %td= 1 - %td= 2 - %td= 3 - %td= 4 - %td= 5 + %td= version.reify.name + %td= version.reify.code + %td= ident_for(version.reify) + %td= l(version.created_at, format: :short) + %td + - if version.reify.registrar + = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + + %td= version.event .row .col-md-6 = paginate @versions .col-md-6.text-right - .pagination - = t(:result_count, count: @contacts.total_count) + :coffee $(".js-reset-form").on "click", (e) -> From 9278e6703f19529a147ac4f600c94c42d2c55853 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 12 Jan 2016 18:37:05 +0200 Subject: [PATCH 007/247] 108869472-archive --- .../admin/contact_versions_controller.rb | 29 +++----- .../admin/domain_versions_controller.rb | 52 ++++++++++--- app/validators/domain_name_validator.rb | 2 +- app/views/admin/contact_versions/index.haml | 54 +++++++++++--- app/views/admin/domain_versions/archive.haml | 73 +++++++++++++++++++ 5 files changed, 171 insertions(+), 39 deletions(-) create mode 100644 app/views/admin/domain_versions/archive.haml diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index cd49011a0..d6c7deb9e 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -3,37 +3,30 @@ class Admin::ContactVersionsController < AdminController def index params[:q] ||= {} + @q = ContactVersion.search(params[:q]) @versions = @q.result.page(params[:page]) - versions = ContactVersion.all + whereS = "1=1" - normalize_search_parameters do - @q = versions.search(params[:q]) - @versions = @q.result.page(params[:page]) + params[:q].each do |key, value| + next if value.empty? + whereS += create_where_string(key, value) end + versions = ContactVersion.includes(:item).where(whereS) + @q = versions.search(params[:q]) + @versions = @q.result.page(params[:page]) @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + end def search render json: ContactVersion.search_by_query(params[:q]) end - def normalize_search_parameters - ca_cache = params[:q][:created_at_lteq] - begin - end_time = params[:q][:created_at_lteq].try(:to_date) - params[:q][:created_at_lteq] = end_time.try(:end_of_day) - end_time = params[:q][:updated_at_gteq].try(:to_date) - params[:q][:updated_at_lteq] = end_time.try(:end_of_day) - rescue - logger.warn('Invalid date') - end - - yield - - params[:q][:created_at_lteq] = ca_cache + def create_where_string(key, value) + " AND object->>'#{key}' ~ '#{value}'" end end diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 985c680f9..6aca493ea 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,18 +1,48 @@ class Admin::DomainVersionsController < AdminController load_and_authorize_resource - # rubocop:disable Style/GuardClause def index - # @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first - # @versions = @domain.versions + params[:q] ||= {} + + @q = DomainVersion.includes(:item).search(params[:q]) + @versions = @q.result.page(params[:page]) + search_params = params[:q].deep_dup + + if search_params[:registrant] + registrant = Contact.find_by_name(search_params[:registrant]) + search_params.delete(:registrant) + end + + if search_params[:registrar] + registrar = Registrar.find_by_name(search_params[:registrar]) + search_params.delete(:registrar) + end + + whereS = "1=1" + + search_params.each do |key, value| + next if value.empty? + whereS += create_where_string(key, value) + end + + whereS += " AND object->>'registrant_id' ~ '#{registrant.id}'" if registrant + whereS += " AND object->>'registrar_id' ~ '#{registrar.id}'" if registrar + + versions = DomainVersion.includes(:item).where(whereS) + @q = versions.search(params[:q]) + @versions = @q.result.page(params[:page]) + @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 + render "admin/domain_versions/archive" - # Depricated it had to load legal document. We may do it by parsing and adding link. - # if @domain.pending_json.present? - # frame = Nokogiri::XML(@domain.pending_json['frame']) - # @pending_user = User.find(@domain.pending_json['current_user_id']) - # @pending_domain = Epp::Domain.find(@domain.id) - # @pending_domain.update(frame, @pending_user, false) - # end end - # rubocop:enable Style/GuardClause + + def search + render json: DomainVersion.search_by_query(params[:q]) end + + def create_where_string(key, value) + " AND object->>'#{key}' ~ '#{value}'" + end + + +end diff --git a/app/validators/domain_name_validator.rb b/app/validators/domain_name_validator.rb index e39437f2b..be83f0835 100644 --- a/app/validators/domain_name_validator.rb +++ b/app/validators/domain_name_validator.rb @@ -38,7 +38,7 @@ class DomainNameValidator < ActiveModel::EachValidator def validate_blocked(value) return true unless value - return false if BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count > 0 + return false if BlockedDomain.where(name: value).count > 0 ZonefileSetting.where(origin: value).count == 0 end end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 195b90783..00cdb53ee 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -1,4 +1,40 @@ -= render 'shared/title', name: t(:contact_versions) += render 'shared/title', name: t(:contacts) + +.row + .col-md-12 + = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| + .row + .col-md-3 + .form-group + = f.label :name + = f.search_field :name, value: params[:q][:name], class: 'form-control', placeholder: t(:name) + .col-md-3 + .form-group + = f.label :id + = f.search_field :id, value: params[:q][:id], class: 'form-control', placeholder: t(:id) + .col-md-3 + .form-group + = f.label :ident + = f.search_field :ident, value: params[:q][:ident], class: 'form-control', placeholder: t(:ident) + .col-md-3 + .form-group + = f.label :phone + = f.search_field :phone, value: params[:q][:phone], class: 'form-control', placeholder: t(:phone) + .row + .col-md-3 + .col-md-3 + .col-md-3 + .form-group + = label_tag t(:results_per_page) + = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) + .col-md-3{style: 'padding-top: 25px;'} + %button.btn.btn-primary +   + %span.glyphicon.glyphicon-search +   + %button.btn.btn-default.js-reset-form + = t(:clear_fields) +%hr .row @@ -8,30 +44,30 @@ %thead %tr %th{class: 'col-xs-2'} - = sort_link(@q, 'name', t(:name)) + = t(:name) %th{class: 'col-xs-2'} - = sort_link(@q, 'code', t(:id)) + = t(:id) %th{class: 'col-xs-2'} - = sort_link(@q, 'ident', t(:ident)) + = t(:ident) %th{class: 'col-xs-2'} - = sort_link(@q, 'registrar_name', t(:registrar)) + = t(:phone) %th{class: 'col-xs-2'} - = sort_link(@q, 'email', t(:created_at)) + = t(:registrar) %th{class: 'col-xs-2'} - = sort_link(@q, 'action', t(:action)) + = t(:action) %tbody - @versions.each do |version| %tr %td= version.reify.name %td= version.reify.code %td= ident_for(version.reify) - %td= l(version.created_at, format: :short) + %td= version.reify.phone %td - if version.reify.registrar = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) - %td= version.event + .row .col-md-6 = paginate @versions diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml new file mode 100644 index 000000000..03334ca64 --- /dev/null +++ b/app/views/admin/domain_versions/archive.haml @@ -0,0 +1,73 @@ += render 'shared/title', name: t(:domains) + +.row + .col-md-12 + = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| + .row + .col-md-3 + .form-group + = label_tag :name + = f.search_field :name, value: params[:q][:name], class: 'form-control', placeholder: t(:name) + .col-md-3 + .form-group + = label_tag :registrant + = f.search_field :registrant, value: params[:q][:registrant], class: 'form-control', placeholder: t(:registrant) + .col-md-3 + .form-group + = label_tag t(:registrar) + = f.search_field :registrar, value: params[:q][:registrar], class: 'form-control', placeholder: t(:registrant) + .col-md-3 + .form-group + = label_tag t(:results_per_page) + = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) + .row + .col-md-3 + .col-md-3 + .col-md-3 + .col-md-3{style: 'padding-top: 25px;'} + %button.btn.btn-primary +   + %span.glyphicon.glyphicon-search +   + %button.btn.btn-default.js-reset-form + = t(:clear_fields) +%hr + + +.row + .col-md-12 + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th{class: 'col-xs-2'} + = t(:name) + %th{class: 'col-xs-2'} + = t(:registrant) + %th{class: 'col-xs-2'} + = t(:registrar) + %th{class: 'col-xs-2'} + = t(:action) + %tbody + - @versions.each do |version| + %tr + %td= version.reify.name + %td + - if version.reify.registrant.ident + = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) + %td + - if version.reify.registrar + = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + %td= version.event + + +.row + .col-md-6 + = paginate @versions + .col-md-6.text-right + + +:coffee + $(".js-reset-form").on "click", (e) -> + e.preventDefault(); + window.location = "#{admin_domain_versions_path}" From 07d6805aa60ce1c493dbfbe4e819f018ed4234c3 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 19 Jan 2016 16:51:19 +0200 Subject: [PATCH 008/247] 111864739-legal_doc_for_pt --- app/models/domain.rb | 3 +++ app/models/epp/domain.rb | 1 + lib/tasks/documents.rake | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 lib/tasks/documents.rake diff --git a/app/models/domain.rb b/app/models/domain.rb index e4882473a..8f2010a5e 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -7,6 +7,8 @@ class Domain < ActiveRecord::Base attr_accessor :roles + attr_accessor :legal_document_id + # TODO: whois requests ip whitelist for full info for own domains and partial info for other domains # TODO: most inputs should be trimmed before validatation, probably some global logic? @@ -821,6 +823,7 @@ class Domain < ActiveRecord::Base log[:admin_contacts] = admin_contact_ids log[:tech_contacts] = tech_contact_ids log[:nameservers] = nameserver_ids + log[:legal_documents]= [legal_document_id] log[:registrant] = [registrant_id] log[:domain_statuses] = domain_status_ids log diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 15e16163a..6cda7712f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -476,6 +476,7 @@ class Epp::Domain < Domain if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id end at_add = attrs_from(frame.css('add'), current_user, 'add') diff --git a/lib/tasks/documents.rake b/lib/tasks/documents.rake new file mode 100644 index 000000000..51ba49108 --- /dev/null +++ b/lib/tasks/documents.rake @@ -0,0 +1,41 @@ +namespace :documents do + + + desc 'Generate all' + task all: :environment do + Rake::Task['documents:log'].invoke + end + + desc 'Generate legaldoc versions' + task log: :environment do + start = Time.zone.now.to_f + puts '-----> Adding documets id for PaperTrail log...' + count = 0 + + LegalDocument.all.each do |x| + + next if x.documentable_id.blank? + + dc = DomainVersion.where(item_id: x.documentable_id) + + dc.each do |y| + + if x.created_at < (y.created_at + (2*60)) && + x.created_at > (y.created_at - (2*60)) + + y.children[:legal_documents] = [x.id] + y.save + count =+1 + + else + + y.children[:legal_documents] = [] + y.save + + end + end + end + puts "-----> Log changed for #{count} rows in #{(Time.zone.now.to_f - start).round(2)} seconds" + end +end + From 556868da6f4c8a42f5d1cc9c589ddc0780495b99 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 20 Jan 2016 12:24:13 +0200 Subject: [PATCH 009/247] 111864739-memory_optimization --- lib/tasks/documents.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/documents.rake b/lib/tasks/documents.rake index 51ba49108..d16025785 100644 --- a/lib/tasks/documents.rake +++ b/lib/tasks/documents.rake @@ -12,7 +12,7 @@ namespace :documents do puts '-----> Adding documets id for PaperTrail log...' count = 0 - LegalDocument.all.each do |x| + LegalDocument.where(documentable_type: Domain).find_each do |x| next if x.documentable_id.blank? From 2430bfebf2f5ed3471e88f0b8ed2597b603c96e6 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 26 Jan 2016 17:17:36 +0200 Subject: [PATCH 010/247] 111864739-contact_type_added --- lib/tasks/documents.rake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tasks/documents.rake b/lib/tasks/documents.rake index d16025785..5ae8fb4df 100644 --- a/lib/tasks/documents.rake +++ b/lib/tasks/documents.rake @@ -1,6 +1,5 @@ namespace :documents do - desc 'Generate all' task all: :environment do Rake::Task['documents:log'].invoke @@ -12,11 +11,16 @@ namespace :documents do puts '-----> Adding documets id for PaperTrail log...' count = 0 - LegalDocument.where(documentable_type: Domain).find_each do |x| + LegalDocument.find_each do |x| next if x.documentable_id.blank? - dc = DomainVersion.where(item_id: x.documentable_id) + document_type = case x.documentable_type + when 'Domain' then DomainVersion + when 'Contact'then ContactVersion + end + + dc = document_type.where(item_id: x.documentable_id) dc.each do |y| From 7f9e1e0c9c689e7ddad7ac7366d15304859841c4 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 1 Feb 2016 17:47:58 +0200 Subject: [PATCH 011/247] 111864739-catcher_for_all_domain_methods --- app/models/epp/domain.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 6cda7712f..667b566ca 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -194,7 +194,10 @@ class Epp::Domain < Domain end at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action) - at[:legal_documents_attributes] = legal_document_from(frame) + + doc = legal_document_from(frame) + self.legal_document_id = doc.id if doc.id + at[:legal_documents_attributes] = doc at end # rubocop: enable Metrics/PerceivedComplexity @@ -476,7 +479,7 @@ class Epp::Domain < Domain if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id + self.legal_document_id = doc.id if doc.id end at_add = attrs_from(frame.css('add'), current_user, 'add') @@ -546,6 +549,7 @@ class Epp::Domain < Domain if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id if doc.id end if Setting.request_confirmation_on_domain_deletion_enabled && @@ -698,7 +702,8 @@ class Epp::Domain < Domain self.registrar = current_user.registrar end - attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + self.legal_document_id = doc.id if doc.id save!(validate: false) return dt @@ -726,7 +731,8 @@ class Epp::Domain < Domain generate_auth_info self.registrar = pt.transfer_to - attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + self.legal_document_id = doc.id if doc.id save!(validate: false) end @@ -747,7 +753,8 @@ class Epp::Domain < Domain status: DomainTransfer::CLIENT_REJECTED ) - attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) + self.legal_document_id = doc.id if doc.id save!(validate: false) end From f087a00bef9ee78fccbac6d926d022f89b1aebc5 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 1 Feb 2016 18:08:44 +0200 Subject: [PATCH 012/247] 111864739-legaldocs_for_contacts --- app/models/contact.rb | 11 ++++++++++- app/models/epp/contact.rb | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index ccc44851d..558e930d9 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -2,6 +2,7 @@ class Contact < ActiveRecord::Base include Versions # version/contact_version.rb include EppErrors include UserEvents + has_paper_trail class_name: "ContactVersion", meta: { children: :children_log } belongs_to :registrar has_many :domain_contacts @@ -9,6 +10,8 @@ class Contact < ActiveRecord::Base has_many :legal_documents, as: :documentable has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant + attr_accessor :legal_document_id + # TODO: remove later has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy @@ -499,6 +502,12 @@ class Contact < ActiveRecord::Base def update_related_whois_records related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) } - end + end + + def children_log + log = HashWithIndifferentAccess.new + log[:legal_documents]= [legal_document_id] + log + end end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index f4773f732..6df2e7b4d 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -38,7 +38,9 @@ class Epp::Contact < Contact legal_frame = f.css('legalDocument').first if legal_frame.present? - at[:legal_documents_attributes] = legal_document_attrs(legal_frame) + doc = legal_document_attrs(legal_frame) + self.legal_document_id = doc.id if doc.id + at[:legal_documents_attributes] = doc end at.merge!(ident_attrs(f.css('ident').first)) if new_record at From feb93b4093ab67b30b4d2d66178457f3d6ed3cfb Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 1 Feb 2016 18:39:06 +0200 Subject: [PATCH 013/247] 111864739-method_fix --- app/models/epp/domain.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 667b566ca..0e53ba264 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -194,10 +194,7 @@ class Epp::Domain < Domain end at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action) - - doc = legal_document_from(frame) - self.legal_document_id = doc.id if doc.id - at[:legal_documents_attributes] = doc + at[:legal_documents_attributes] = legal_document_from(frame) at end # rubocop: enable Metrics/PerceivedComplexity From 0141026408f6e4ea1e90c976c5e48c96ab218c45 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 2 Feb 2016 16:38:16 +0200 Subject: [PATCH 014/247] 111864739-nested_id_catch --- app/models/contact.rb | 11 +++++++++++ app/models/epp/contact.rb | 4 +--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 558e930d9..2400ea33a 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -17,6 +17,8 @@ class Contact < ActiveRecord::Base accepts_nested_attributes_for :legal_documents + before_save :catch_legal_doc_id + validates :name, :phone, :email, :ident, :ident_type, :street, :city, :zip, :country_code, :registrar, presence: true @@ -510,4 +512,13 @@ class Contact < ActiveRecord::Base log end + def catch_legal_doc_id + + if !legal_document_id && doc = self.legal_documents.last.new_record? + + legal_document_id = doc.id + + end +end + end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 6df2e7b4d..f4773f732 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -38,9 +38,7 @@ class Epp::Contact < Contact legal_frame = f.css('legalDocument').first if legal_frame.present? - doc = legal_document_attrs(legal_frame) - self.legal_document_id = doc.id if doc.id - at[:legal_documents_attributes] = doc + at[:legal_documents_attributes] = legal_document_attrs(legal_frame) end at.merge!(ident_attrs(f.css('ident').first)) if new_record at From 59f7f364ad3fc2c1734deeaa19ba9bc9e1a7f8ec Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 4 Feb 2016 16:32:30 +0200 Subject: [PATCH 015/247] 11186739-revert_to_2430bfebf2f5ed3471e88f0b8ed2597b603c96e6 --- app/models/contact.rb | 20 -------------------- app/models/epp/domain.rb | 12 ++++-------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 2400ea33a..fdb114673 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -2,7 +2,6 @@ class Contact < ActiveRecord::Base include Versions # version/contact_version.rb include EppErrors include UserEvents - has_paper_trail class_name: "ContactVersion", meta: { children: :children_log } belongs_to :registrar has_many :domain_contacts @@ -10,15 +9,11 @@ class Contact < ActiveRecord::Base has_many :legal_documents, as: :documentable has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant - attr_accessor :legal_document_id - # TODO: remove later has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy accepts_nested_attributes_for :legal_documents - before_save :catch_legal_doc_id - validates :name, :phone, :email, :ident, :ident_type, :street, :city, :zip, :country_code, :registrar, presence: true @@ -506,19 +501,4 @@ class Contact < ActiveRecord::Base related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) } end - def children_log - log = HashWithIndifferentAccess.new - log[:legal_documents]= [legal_document_id] - log - end - - def catch_legal_doc_id - - if !legal_document_id && doc = self.legal_documents.last.new_record? - - legal_document_id = doc.id - - end -end - end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 0e53ba264..6cda7712f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -476,7 +476,7 @@ class Epp::Domain < Domain if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id if doc.id + self.legal_document_id = doc.id end at_add = attrs_from(frame.css('add'), current_user, 'add') @@ -546,7 +546,6 @@ class Epp::Domain < Domain if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id if doc.id end if Setting.request_confirmation_on_domain_deletion_enabled && @@ -699,8 +698,7 @@ class Epp::Domain < Domain self.registrar = current_user.registrar end - doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) - self.legal_document_id = doc.id if doc.id + attach_legal_document(self.class.parse_legal_document_from_frame(frame)) save!(validate: false) return dt @@ -728,8 +726,7 @@ class Epp::Domain < Domain generate_auth_info self.registrar = pt.transfer_to - doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) - self.legal_document_id = doc.id if doc.id + attach_legal_document(self.class.parse_legal_document_from_frame(frame)) save!(validate: false) end @@ -750,8 +747,7 @@ class Epp::Domain < Domain status: DomainTransfer::CLIENT_REJECTED ) - doc = attach_legal_document(self.class.parse_legal_document_from_frame(frame)) - self.legal_document_id = doc.id if doc.id + attach_legal_document(self.class.parse_legal_document_from_frame(frame)) save!(validate: false) end From 185e1d5c93927e1686bc257dc5873ddab451c609 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 10 Feb 2016 10:38:47 +0200 Subject: [PATCH 016/247] 110687814-update_function --- app/models/epp/domain.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 3f32ce6d5..62c6ee7ac 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -3,9 +3,11 @@ class Epp::Domain < Domain include EppErrors # TODO: remove this spagetti once data in production is correct. - attr_accessor :is_renewal, :is_transfer + attr_accessor :is_renewal, :is_transfer, :current_user before_validation :manage_permissions + before_update :write_update_values + def manage_permissions return if is_admin # this bad hack for 109086524, refactor later return true if is_transfer || is_renewal @@ -14,6 +16,11 @@ class Epp::Domain < Domain false end + def write_update_values + self.updator_str = current_user.identity_code if current_user + self.updated_at = Time.zone.now + end + after_validation :validate_contacts def validate_contacts return true if is_renewal || is_transfer @@ -488,6 +495,8 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] + @current_user = current_user + if errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && frame.css('registrant').present? && From f77e599e2f44f07f953c62ab6216cccb57374964 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 12 Feb 2016 18:08:39 +0200 Subject: [PATCH 017/247] 108869472-empty_row_fix --- app/views/admin/domain_versions/archive.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 03334ca64..f4b87cbae 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -53,7 +53,7 @@ %tr %td= version.reify.name %td - - if version.reify.registrant.ident + - if version.reify.registrant = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) %td - if version.reify.registrar From 6ebcaf69d08ae960933c1c6cabfd701131c475c6 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 15 Feb 2016 17:52:30 +0200 Subject: [PATCH 018/247] 111864739-contact_and_domain_create --- app/controllers/epp/contacts_controller.rb | 2 ++ app/controllers/epp/domains_controller.rb | 2 ++ app/models/contact.rb | 16 +++++++-- app/models/epp/contact.rb | 41 +++++++++++++++++++--- app/models/epp/domain.rb | 23 ++++++------ 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 5b0a39bbf..14c6de7b6 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -19,6 +19,8 @@ class Epp::ContactsController < EppController authorize! :create, Epp::Contact @contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar) + @contact.add_legal_file_to_new(params[:parsed_frame]) + if @contact.save render_epp_response '/epp/contacts/create' else diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 91ddeb93d..fb3441580 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -30,6 +30,8 @@ class Epp::DomainsController < EppController handle_errors and return unless balance_ok?('create') # loads pricelist in this method ActiveRecord::Base.transaction do + @domain.add_legal_file_to_new(params[:parsed_frame]) + if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain? current_user.registrar.debit!({ sum: @domain_pricelist.price.amount, diff --git a/app/models/contact.rb b/app/models/contact.rb index fdb114673..5ec9c0a46 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -12,6 +12,10 @@ class Contact < ActiveRecord::Base # TODO: remove later has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy + has_paper_trail class_name: "ContactVersion", meta: { children: :children_log } + + attr_accessor :legal_document_id + accepts_nested_attributes_for :legal_documents validates :name, :phone, :email, :ident, :ident_type, @@ -497,8 +501,14 @@ class Contact < ActiveRecord::Base ]).present? end - def update_related_whois_records - related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) } - end + def update_related_whois_records + related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) } + end + + def children_log + log = HashWithIndifferentAccess.new + log[:legal_documents]= [legal_document_id] + log + end end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index f4773f732..a3180a534 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -36,10 +36,7 @@ class Epp::Contact < Contact at[:country_code] = f.css('postalInfo addr cc').text if f.css('postalInfo addr cc').present? at[:auth_info] = f.css('authInfo pw').text if f.css('authInfo pw').present? - legal_frame = f.css('legalDocument').first - if legal_frame.present? - at[:legal_documents_attributes] = legal_document_attrs(legal_frame) - end + at.merge!(ident_attrs(f.css('ident').first)) if new_record at end @@ -152,6 +149,12 @@ class Epp::Contact < Contact legal_frame = frame.css('legalDocument').first at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame) + + if doc = attach_legal_document(parse_legal_document_from_frame(frame)) + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id + end + self.deliver_emails = true # turn on email delivery for epp @@ -213,4 +216,34 @@ class Epp::Contact < Contact status_list end + + def attach_legal_document(legal_document_data) + return unless legal_document_data + + legal_documents.create( + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + end + + def add_legal_file_to_new frame + if doc = attach_legal_document(parse_legal_document_from_frame(frame)) + raise ActiveRecord::Rollback if doc && doc.id.nil? + + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id + end + end + + def parse_legal_document_from_frame frame + ld = frame.css('legalDocument').first + return nil unless ld + return nil if ld.text.starts_with?(ENV['legal_documents_dir']) + + { + body: ld.text, + type: ld['type'] + } + end + end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 6cda7712f..d0f83fd9f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -194,9 +194,21 @@ class Epp::Domain < Domain end at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action) - at[:legal_documents_attributes] = legal_document_from(frame) + at end + + + # Adding legal doc to domain and + # if something goes wrong - raise Rollback error + def add_legal_file_to_new frame + if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) + raise ActiveRecord::Rollback if doc && doc.id.nil? + + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id + end + end # rubocop: enable Metrics/PerceivedComplexity # rubocop: enable Metrics/CyclomaticComplexity # rubocop: enable Metrics/MethodLength @@ -456,15 +468,6 @@ class Epp::Domain < Domain status_list end - def legal_document_from(frame) - ld = frame.css('legalDocument').first - return [] unless ld - - [{ - body: ld.text, - document_type: ld['type'] - }] - end # rubocop: disable Metrics/AbcSize # rubocop: disable Metrics/CyclomaticComplexity From 577762a2bc25b534e8a06c5ff61507d94ec8fa41 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 25 Feb 2016 13:54:46 +0200 Subject: [PATCH 019/247] 110687814-migrations_and_values --- app/controllers/epp/contacts_controller.rb | 2 +- app/models/epp/contact.rb | 13 ++++++++++++- app/models/epp/domain.rb | 2 +- .../20160225113801_add_up_id_value_to_domain.rb | 5 +++++ .../20160225113812_add_up_id_value_to_contact.rb | 5 +++++ 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160225113801_add_up_id_value_to_domain.rb create mode 100644 db/migrate/20160225113812_add_up_id_value_to_contact.rb diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 5b0a39bbf..22473bae7 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -29,7 +29,7 @@ class Epp::ContactsController < EppController def update authorize! :update, @contact, @password - if @contact.update_attributes(params[:parsed_frame]) + if @contact.update_attributes(params[:parsed_frame], current_user) render_epp_response 'epp/contacts/update' else handle_errors(@contact) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 54806b88d..7727666d2 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -1,16 +1,25 @@ class Epp::Contact < Contact include EppErrors + attr_accessor :current_user + # disable STI, there is type column present self.inheritance_column = :sti_disabled before_validation :manage_permissions + before_update :write_update_values + def manage_permissions return unless update_prohibited? || delete_prohibited? add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) false end + def write_update_values + self.upid = current_user.identity_code if current_user + self.updated_at = Time.zone.now + end + class << self # support legacy search def find_by_epp_code(code) @@ -142,7 +151,7 @@ class Epp::Contact < Contact end # rubocop:disable Metrics/AbcSize - def update_attributes(frame) + def update_attributes(frame, current_user) return super if frame.blank? at = {}.with_indifferent_access at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false)) @@ -177,6 +186,8 @@ class Epp::Contact < Contact end end + @current_user = current_user + super(at) end # rubocop:enable Metrics/AbcSize diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 62c6ee7ac..8769acc1e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -17,7 +17,7 @@ class Epp::Domain < Domain end def write_update_values - self.updator_str = current_user.identity_code if current_user + self.upid = current_user.identity_code if current_user self.updated_at = Time.zone.now end diff --git a/db/migrate/20160225113801_add_up_id_value_to_domain.rb b/db/migrate/20160225113801_add_up_id_value_to_domain.rb new file mode 100644 index 000000000..df3d70e6f --- /dev/null +++ b/db/migrate/20160225113801_add_up_id_value_to_domain.rb @@ -0,0 +1,5 @@ +class AddUpIdValueToDomain < ActiveRecord::Migration + def change + add_column :domains, :upid, :string + end +end diff --git a/db/migrate/20160225113812_add_up_id_value_to_contact.rb b/db/migrate/20160225113812_add_up_id_value_to_contact.rb new file mode 100644 index 000000000..927950bd2 --- /dev/null +++ b/db/migrate/20160225113812_add_up_id_value_to_contact.rb @@ -0,0 +1,5 @@ +class AddUpIdValueToContact < ActiveRecord::Migration + def change + add_column :contacts, :upid, :string + end +end From 7a659da6a3603e8eb7db45c8691e07d6f83cc44e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 25 Feb 2016 14:20:19 +0200 Subject: [PATCH 020/247] Story#114471339 - change order when legal docs are saved into DB --- app/models/epp/contact.rb | 18 +++++++++++++----- app/models/epp/domain.rb | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index a3180a534..571cae45b 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -227,14 +227,22 @@ class Epp::Contact < Contact end def add_legal_file_to_new frame - if doc = attach_legal_document(parse_legal_document_from_frame(frame)) - raise ActiveRecord::Rollback if doc && doc.id.nil? + legal_document_data = Epp::Contact.parse_legal_document_from_frame(frame) + return unless legal_document_data - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id - end + doc = LegalDocument.create( + documentable_type: Contact, + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + raise ActiveRecord::Rollback if doc && doc.id.nil? + self.legal_documents = [doc] + + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id end + def parse_legal_document_from_frame frame ld = frame.css('legalDocument').first return nil unless ld diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index d0f83fd9f..1ee8a2d92 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -202,12 +202,19 @@ class Epp::Domain < Domain # Adding legal doc to domain and # if something goes wrong - raise Rollback error def add_legal_file_to_new frame - if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) - raise ActiveRecord::Rollback if doc && doc.id.nil? + legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) + return unless legal_document_data - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id - end + doc = LegalDocument.create( + documentable_type: Domain, + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + raise ActiveRecord::Rollback if doc && doc.id.nil? + self.legal_documents = [doc] + + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id end # rubocop: enable Metrics/PerceivedComplexity # rubocop: enable Metrics/CyclomaticComplexity From 30fe6bd1e66c58176aff046117c9dc89f278bd54 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 25 Feb 2016 17:01:41 +0200 Subject: [PATCH 021/247] Story#114471339 - move parse_legal_document_from_frame to one braking point --- app/models/epp/contact.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 571cae45b..e3b972394 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -150,7 +150,7 @@ class Epp::Contact < Contact legal_frame = frame.css('legalDocument').first at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame) - if doc = attach_legal_document(parse_legal_document_from_frame(frame)) + if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? self.legal_document_id = doc.id end @@ -227,7 +227,7 @@ class Epp::Contact < Contact end def add_legal_file_to_new frame - legal_document_data = Epp::Contact.parse_legal_document_from_frame(frame) + legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) return unless legal_document_data doc = LegalDocument.create( @@ -242,16 +242,4 @@ class Epp::Contact < Contact self.legal_document_id = doc.id end - - def parse_legal_document_from_frame frame - ld = frame.css('legalDocument').first - return nil unless ld - return nil if ld.text.starts_with?(ENV['legal_documents_dir']) - - { - body: ld.text, - type: ld['type'] - } - end - end From 28fcf0eb4558dc40d763e0f8cd57ebb95b24356a Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 26 Feb 2016 13:58:38 +0200 Subject: [PATCH 022/247] 113430903-que_jobs_for_set_delete_candidate --- app/jobs/domain_set_delete_candidate_job.rb | 8 ++++++++ app/models/domain_cron.rb | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 app/jobs/domain_set_delete_candidate_job.rb diff --git a/app/jobs/domain_set_delete_candidate_job.rb b/app/jobs/domain_set_delete_candidate_job.rb new file mode 100644 index 000000000..7101c237c --- /dev/null +++ b/app/jobs/domain_set_delete_candidate_job.rb @@ -0,0 +1,8 @@ +class DomainSetDeleteCandidateJob < Que::Job + + def run(domain_id) + domain = Domain.find(domain_id) + domain.statuses << DomainStatus::DELETE_CANDIDATE + domain.save(validate: false) + end +end diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 74c09740e..90ab37044 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -74,12 +74,11 @@ class DomainCron d.each do |domain| next unless domain.delete_candidateable? real += 1 - domain.statuses << DomainStatus::DELETE_CANDIDATE - STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test? - domain.save(validate: false) and marked += 1 + STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? + DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) and marked += 1 end ensure # the operator should see what was accomplished - STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test? end marked end From 7784a44f8de60e6518034b308392cd3ed02d2222 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 26 Feb 2016 15:56:51 +0200 Subject: [PATCH 023/247] 110687814-migrations_code_change --- app/models/epp/contact.rb | 9 ++------- app/models/epp/domain.rb | 9 ++------- db/migrate/20160225113801_add_up_id_value_to_domain.rb | 2 +- db/migrate/20160225113812_add_up_id_value_to_contact.rb | 2 +- db/migrate/20160226132045_add_up_date_value_to_domain.rb | 5 +++++ .../20160226132056_add_up_date_value_to_contact.rb | 5 +++++ 6 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 db/migrate/20160226132045_add_up_date_value_to_domain.rb create mode 100644 db/migrate/20160226132056_add_up_date_value_to_contact.rb diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 7727666d2..303113f02 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -7,7 +7,6 @@ class Epp::Contact < Contact self.inheritance_column = :sti_disabled before_validation :manage_permissions - before_update :write_update_values def manage_permissions return unless update_prohibited? || delete_prohibited? @@ -15,11 +14,6 @@ class Epp::Contact < Contact false end - def write_update_values - self.upid = current_user.identity_code if current_user - self.updated_at = Time.zone.now - end - class << self # support legacy search def find_by_epp_code(code) @@ -186,7 +180,8 @@ class Epp::Contact < Contact end end - @current_user = current_user + self.upid = current_user.id if current_user + self.update = Time.zone.now super(at) end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 8769acc1e..aca475cf5 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -6,7 +6,6 @@ class Epp::Domain < Domain attr_accessor :is_renewal, :is_transfer, :current_user before_validation :manage_permissions - before_update :write_update_values def manage_permissions return if is_admin # this bad hack for 109086524, refactor later @@ -16,11 +15,6 @@ class Epp::Domain < Domain false end - def write_update_values - self.upid = current_user.identity_code if current_user - self.updated_at = Time.zone.now - end - after_validation :validate_contacts def validate_contacts return true if is_renewal || is_transfer @@ -495,7 +489,8 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] - @current_user = current_user + self.upid = current_user.id if current_user + self.update = Time.zone.now if errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && diff --git a/db/migrate/20160225113801_add_up_id_value_to_domain.rb b/db/migrate/20160225113801_add_up_id_value_to_domain.rb index df3d70e6f..9879c8555 100644 --- a/db/migrate/20160225113801_add_up_id_value_to_domain.rb +++ b/db/migrate/20160225113801_add_up_id_value_to_domain.rb @@ -1,5 +1,5 @@ class AddUpIdValueToDomain < ActiveRecord::Migration def change - add_column :domains, :upid, :string + add_column :domains, :upid, :integer end end diff --git a/db/migrate/20160225113812_add_up_id_value_to_contact.rb b/db/migrate/20160225113812_add_up_id_value_to_contact.rb index 927950bd2..b78478e75 100644 --- a/db/migrate/20160225113812_add_up_id_value_to_contact.rb +++ b/db/migrate/20160225113812_add_up_id_value_to_contact.rb @@ -1,5 +1,5 @@ class AddUpIdValueToContact < ActiveRecord::Migration def change - add_column :contacts, :upid, :string + add_column :contacts, :upid, :integer end end diff --git a/db/migrate/20160226132045_add_up_date_value_to_domain.rb b/db/migrate/20160226132045_add_up_date_value_to_domain.rb new file mode 100644 index 000000000..c3568e6dd --- /dev/null +++ b/db/migrate/20160226132045_add_up_date_value_to_domain.rb @@ -0,0 +1,5 @@ +class AddUpDateValueToDomain < ActiveRecord::Migration + def change + add_column :domains, :update, :timestamp + end +end diff --git a/db/migrate/20160226132056_add_up_date_value_to_contact.rb b/db/migrate/20160226132056_add_up_date_value_to_contact.rb new file mode 100644 index 000000000..99f90d662 --- /dev/null +++ b/db/migrate/20160226132056_add_up_date_value_to_contact.rb @@ -0,0 +1,5 @@ +class AddUpDateValueToContact < ActiveRecord::Migration + def change + add_column :contacts, :update, :timestamp + end +end From 003bfed538552ab64903a0d7e8423064dc200a11 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 26 Feb 2016 16:52:08 +0200 Subject: [PATCH 024/247] 110687814-attr_accessor_removed --- app/models/epp/contact.rb | 2 -- app/models/epp/domain.rb | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 303113f02..725d8d2a2 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -1,8 +1,6 @@ class Epp::Contact < Contact include EppErrors - attr_accessor :current_user - # disable STI, there is type column present self.inheritance_column = :sti_disabled diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index aca475cf5..104abeb57 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -3,7 +3,7 @@ class Epp::Domain < Domain include EppErrors # TODO: remove this spagetti once data in production is correct. - attr_accessor :is_renewal, :is_transfer, :current_user + attr_accessor :is_renewal, :is_transfer before_validation :manage_permissions From d3ad01f1a2d98305629dd71c21aca178a42dd725 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 2 Mar 2016 14:36:35 +0200 Subject: [PATCH 025/247] 18869472-archive_changes --- .../admin/domain_versions_controller.rb | 11 +++- app/views/admin/contact_versions/index.haml | 3 + app/views/admin/domain_versions/archive.haml | 12 +++- app/views/admin/domain_versions/show.haml | 63 +++++++++++++++++++ 4 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 app/views/admin/domain_versions/show.haml diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 6aca493ea..6a3a89d9f 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -22,7 +22,12 @@ class Admin::DomainVersionsController < AdminController search_params.each do |key, value| next if value.empty? - whereS += create_where_string(key, value) + case key + when 'event' + whereS += " AND event = '#{value}'" + else + whereS += create_where_string(key, value) + end end whereS += " AND object->>'registrant_id' ~ '#{registrant.id}'" if registrant @@ -36,6 +41,10 @@ class Admin::DomainVersionsController < AdminController end + def show + @version = DomainVersion.find(params[:id]) + end + def search render json: DomainVersion.search_by_query(params[:q]) end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 00cdb53ee..2384503bd 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -53,6 +53,8 @@ = t(:phone) %th{class: 'col-xs-2'} = t(:registrar) + %th{class: 'col-xs-2'} + = t(:action_date) %th{class: 'col-xs-2'} = t(:action) %tbody @@ -65,6 +67,7 @@ %td - if version.reify.registrar = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + %td= l(version.created_at, format: :short) %td= version.event diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index f4b87cbae..94ed66658 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -18,12 +18,15 @@ = f.search_field :registrar, value: params[:q][:registrar], class: 'form-control', placeholder: t(:registrant) .col-md-3 .form-group - = label_tag t(:results_per_page) - = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) + = label_tag :action + = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } .row .col-md-3 .col-md-3 .col-md-3 + .form-group + = label_tag t(:results_per_page) + = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) .col-md-3{style: 'padding-top: 25px;'} %button.btn.btn-primary   @@ -46,18 +49,21 @@ = t(:registrant) %th{class: 'col-xs-2'} = t(:registrar) + %th{class: 'col-xs-2'} + = t(:action_date) %th{class: 'col-xs-2'} = t(:action) %tbody - @versions.each do |version| %tr - %td= version.reify.name + %td= link_to(version.reify.name, admin_domain_version_path(version.id)) %td - if version.reify.registrant = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) %td - if version.reify.registrar = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + %td= l(version.created_at, format: :short) %td= version.event diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml new file mode 100644 index 000000000..8e3834e17 --- /dev/null +++ b/app/views/admin/domain_versions/show.haml @@ -0,0 +1,63 @@ += render 'shared/title', name: @version.reify.name + + +- if @version + - children = HashWithIndifferentAccess.new(@version.children) + - nameservers = Nameserver.where(id: children[:nameservers]) + - tech_contacts = Contact.where(id: children[:tech_contacts]) + - admin_contacts = Contact.where(id: children[:admin_contacts]) + - registrant = Contact.where(id: children[:registrant]) + - event = @version.event + - creator = plain_username(@version.terminator) + + +.row + .col-md-12 + .panel.panel-default + .panel-heading + %h3.panel-title + = l(@version.reify.updated_at, format: :short) + = event + = creator + .panel-body + %dl.dl-horizontal + %dt= t(:name) + %dd= link_to(@version.reify.name, admin_domain_path(@version.item_id)) + %dt= t(:statuses) + %dd + - if @version.reify.statuses.present? + - @version.reify.statuses.each do |s| + = s + %dt= t(:registrant) + %dd + - registrant.each do |r| + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:admin_contacts) + %dd + - admin_contacts.each do |r| + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:tech_contacts) + %dd + - tech_contacts.each do |r| + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:nameservers) + %dd + - nameservers.each do |ns| + = ns[:hostname] + = ns[:ipv4] + = ns[:ipv6] + %br + %dt= t(:registrar) + %dd= @version.reify.registrar.name \ No newline at end of file From 57bd1c77b6e9ae9fcdcb5cc9c1d9006fffd3c51b Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 2 Mar 2016 17:44:25 +0200 Subject: [PATCH 026/247] 113430903-new_job_added --- app/jobs/domain_delete_job.rb | 16 ++++++++++++++++ app/jobs/domain_set_delete_candidate_job.rb | 1 + app/models/domain_cron.rb | 15 +++------------ 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 app/jobs/domain_delete_job.rb diff --git a/app/jobs/domain_delete_job.rb b/app/jobs/domain_delete_job.rb new file mode 100644 index 000000000..5336dc466 --- /dev/null +++ b/app/jobs/domain_delete_job.rb @@ -0,0 +1,16 @@ +class DomainDeleteJob < Que::Job + + def run(domain_id) + domain = Domain.find(domain_id) + + WhoisRecord.where(domain_id: domain.id).destroy_all + + domain.destroy + bye_bye = domain.versions.last + domain.registrar.messages.create!( + body: "#{I18n.t(:domain_deleted)}: #{domain.name}", + attached_obj_id: bye_bye.id, + attached_obj_type: bye_bye.class.to_s + ) + end +end diff --git a/app/jobs/domain_set_delete_candidate_job.rb b/app/jobs/domain_set_delete_candidate_job.rb index 7101c237c..cfa55cf6e 100644 --- a/app/jobs/domain_set_delete_candidate_job.rb +++ b/app/jobs/domain_set_delete_candidate_job.rb @@ -4,5 +4,6 @@ class DomainSetDeleteCandidateJob < Que::Job domain = Domain.find(domain_id) domain.statuses << DomainStatus::DELETE_CANDIDATE domain.save(validate: false) + DomainDeleteJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) end end diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 90ab37044..5fd4331f8 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -87,22 +87,13 @@ class DomainCron STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test? c = 0 - Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| - WhoisRecord.where(domain_id: x.id).destroy_all - destroy_with_message x - STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id} (#{x.name})\n" unless Rails.env.test? - - c += 1 - end - Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| - WhoisRecord.where(domain_id: x.id).destroy_all - destroy_with_message x - STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? + DomainDeleteJob.enqueue(x.id, run_at: rand(24*60).minutes.from_now) + STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 end - STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Job destroy added for #{c} domains\n" unless Rails.env.test? end # rubocop: enable Metrics/AbcSize From 5cc3e0d1dee35b23c7a3d05acf125341ec86dd04 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 2 Mar 2016 18:34:56 +0200 Subject: [PATCH 027/247] 110687814-name_fix --- db/migrate/20160226132045_add_up_date_value_to_domain.rb | 2 +- db/migrate/20160226132056_add_up_date_value_to_contact.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20160226132045_add_up_date_value_to_domain.rb b/db/migrate/20160226132045_add_up_date_value_to_domain.rb index c3568e6dd..5fdc3d196 100644 --- a/db/migrate/20160226132045_add_up_date_value_to_domain.rb +++ b/db/migrate/20160226132045_add_up_date_value_to_domain.rb @@ -1,5 +1,5 @@ class AddUpDateValueToDomain < ActiveRecord::Migration def change - add_column :domains, :update, :timestamp + add_column :domains, :up_date, :timestamp end end diff --git a/db/migrate/20160226132056_add_up_date_value_to_contact.rb b/db/migrate/20160226132056_add_up_date_value_to_contact.rb index 99f90d662..f7ba92313 100644 --- a/db/migrate/20160226132056_add_up_date_value_to_contact.rb +++ b/db/migrate/20160226132056_add_up_date_value_to_contact.rb @@ -1,5 +1,5 @@ class AddUpDateValueToContact < ActiveRecord::Migration def change - add_column :contacts, :update, :timestamp + add_column :contacts, :up_date, :timestamp end end From 9926a7e54c8e6da4443f1e4ea66fc0c27f71177d Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 2 Mar 2016 18:46:08 +0200 Subject: [PATCH 028/247] 110687814-variable_changes --- app/models/epp/contact.rb | 2 +- app/models/epp/domain.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 725d8d2a2..6a3540888 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -179,7 +179,7 @@ class Epp::Contact < Contact end self.upid = current_user.id if current_user - self.update = Time.zone.now + self.up_date = Time.zone.now super(at) end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 104abeb57..b92a33e5a 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -490,7 +490,7 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] self.upid = current_user.id if current_user - self.update = Time.zone.now + self.up_date = Time.zone.now if errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && From 519c8908ee101862557361c7da169434ce8bc4c3 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 3 Mar 2016 20:59:28 +0200 Subject: [PATCH 029/247] 113430903-precision_for_minutes --- app/jobs/domain_set_delete_candidate_job.rb | 2 +- app/models/domain_cron.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/jobs/domain_set_delete_candidate_job.rb b/app/jobs/domain_set_delete_candidate_job.rb index cfa55cf6e..ffdf54277 100644 --- a/app/jobs/domain_set_delete_candidate_job.rb +++ b/app/jobs/domain_set_delete_candidate_job.rb @@ -4,6 +4,6 @@ class DomainSetDeleteCandidateJob < Que::Job domain = Domain.find(domain_id) domain.statuses << DomainStatus::DELETE_CANDIDATE domain.save(validate: false) - DomainDeleteJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) + DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) end end diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 5fd4331f8..d4e26f10a 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -75,7 +75,7 @@ class DomainCron next unless domain.delete_candidateable? real += 1 STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? - DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) and marked += 1 + DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) and marked += 1 end ensure # the operator should see what was accomplished STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test? @@ -88,7 +88,7 @@ class DomainCron c = 0 Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| - DomainDeleteJob.enqueue(x.id, run_at: rand(24*60).minutes.from_now) + DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 end From aa1e08942b48c785d7cdb8313be3d2480b485afd Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 4 Mar 2016 12:47:39 +0200 Subject: [PATCH 030/247] 113430903-minutes_added_for_condition --- app/jobs/domain_set_delete_candidate_job.rb | 2 +- app/models/domain_cron.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/jobs/domain_set_delete_candidate_job.rb b/app/jobs/domain_set_delete_candidate_job.rb index ffdf54277..cc6f3f255 100644 --- a/app/jobs/domain_set_delete_candidate_job.rb +++ b/app/jobs/domain_set_delete_candidate_job.rb @@ -4,6 +4,6 @@ class DomainSetDeleteCandidateJob < Que::Job domain = Domain.find(domain_id) domain.statuses << DomainStatus::DELETE_CANDIDATE domain.save(validate: false) - DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) + DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) end end diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index d4e26f10a..24c0aac74 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -75,7 +75,7 @@ class DomainCron next unless domain.delete_candidateable? real += 1 STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? - DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) and marked += 1 + DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) and marked += 1 end ensure # the operator should see what was accomplished STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test? @@ -88,7 +88,7 @@ class DomainCron c = 0 Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| - DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) + DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 end From 8f5a73a3ec92261191f724b8df5cf17163162966 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 7 Mar 2016 18:07:11 +0200 Subject: [PATCH 031/247] 108869472-navigayion_list_added --- .../admin/domain_versions_controller.rb | 4 +++ app/views/admin/domain_versions/show.haml | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 6a3a89d9f..4a309e9af 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -42,7 +42,11 @@ class Admin::DomainVersionsController < AdminController end def show + per_page = 7 @version = DomainVersion.find(params[:id]) + @q = DomainVersion.where(item_id: @version.item_id).search + @versions = @q.result.page(params[:page]) + @versions = @versions.per(per_page) end def search diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 8e3834e17..81c144c4c 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,6 +1,12 @@ +- content_for :actions do + = link_to(t(:previous), admin_domain_path(@version.item_id), class: 'btn btn-primary') + = link_to(t(:next), admin_domain_path(@version.item_id), method: :get, class: 'btn btn btn-default') + = render 'shared/title', name: @version.reify.name + + - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.where(id: children[:nameservers]) @@ -12,8 +18,8 @@ .row - .col-md-12 - .panel.panel-default + .col-md-8 + .panel.panel-default{:style => "min-height:400px;"} .panel-heading %h3.panel-title = l(@version.reify.updated_at, format: :short) @@ -60,4 +66,20 @@ = ns[:ipv6] %br %dt= t(:registrar) - %dd= @version.reify.registrar.name \ No newline at end of file + %dd= @version.reify.registrar.name + .col-md-4 + .panel.panel-default{:style => "min-height:400px;"} + %ul.nav.nav-pills.nav-stacked + - @versions.each do |vs| + - if vs.id == @version.id + %li.active + = link_to admin_domain_version_path(vs.id) do + = l(vs.reify.updated_at, format: :short) + = vs.event + - else + %li + = link_to admin_domain_version_path(vs.id) do + = l(vs.reify.updated_at, format: :short) + = vs.event + %span{:style => "padding-left:10px;position: absolute; bottom: 10px;"} + = paginate @versions From 65f6b4b43e2c5ad137bc1ad621111fe81751b5ce Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 8 Mar 2016 15:06:53 +0200 Subject: [PATCH 032/247] Story#114871365 - add address country_code validation --- app/models/contact.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index aa3819850..4f2e7105e 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -39,8 +39,8 @@ class Contact < ActiveRecord::Base self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank? end - before_validation :set_ident_country_code - before_validation :prefix_code + before_validation :val_upcase_country_code + before_validation :val_prefix_code before_create :generate_auth_info before_update :manage_emails @@ -298,7 +298,7 @@ class Contact < ActiveRecord::Base end # rubocop:disable Metrics/CyclomaticComplexity - def prefix_code + def val_prefix_code return nil unless new_record? return nil if registrar.blank? code = self[:code] @@ -338,13 +338,17 @@ class Contact < ActiveRecord::Base destroy end - def set_ident_country_code - return true unless ident_country_code_changed? && ident_country_code.present? - code = Country.new(ident_country_code) - if code + def val_upcase_country_code + if code = Country.new(ident_country_code) self.ident_country_code = code.alpha2 else errors.add(:ident, :invalid_country_code) + end if ident_country_code_changed? && ident_country_code.present? + + if code = Country.new(country_code) + self.country_code = code.alpha2 + else + errors.add(:country_code, :invalid_country_code) end end From d18fb5e6be46feb9c01920732bff374ffc36e299 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 8 Mar 2016 15:46:48 +0200 Subject: [PATCH 033/247] Story#114871365 - add rake task to update contacts country code --- lib/tasks/convert.rake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index ba0e547dc..849450c7c 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -32,5 +32,21 @@ namespace :convert do d.save! end end + + + desc 'Contact Address Country Code Upcase' + task country_code_ucase: :environment do + count = 0 + Contact.find_each do |c| + if c.country_code.present? && c.country_code != c.country_code.upcase + c.country_code = c.country_code.upcase + c.update_columns(country_code: c.country_code.upcase) + # c.send(:record_update) + + count +=1 + puts "#{count} contacts has been changed" if count % 1000 == 0 + end + end + end end From 3615f4dd8bd8131cbc455e635767353b95c4fdc5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 8 Mar 2016 15:48:26 +0200 Subject: [PATCH 034/247] Story#114871365 - add rake task to update contacts country code (typo) --- lib/tasks/convert.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index 849450c7c..d55778ad9 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -35,7 +35,7 @@ namespace :convert do desc 'Contact Address Country Code Upcase' - task country_code_ucase: :environment do + task country_code_upcase: :environment do count = 0 Contact.find_each do |c| if c.country_code.present? && c.country_code != c.country_code.upcase From 2af2a2ab1cc7aace3a539759541492d1fde2b253 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 11 Mar 2016 15:13:40 +0200 Subject: [PATCH 035/247] Story#114871365 - Better error messages for country codes in contact --- app/models/contact.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 4f2e7105e..baa51c19e 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -32,6 +32,7 @@ class Contact < ActiveRecord::Base validate :val_ident_valid_format? validate :uniq_statuses? validate :validate_html + validate :val_country_code after_initialize do self.statuses = [] if statuses.nil? @@ -39,7 +40,7 @@ class Contact < ActiveRecord::Base self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank? end - before_validation :val_upcase_country_code + before_validation :to_upcase_country_code before_validation :val_prefix_code before_create :generate_auth_info @@ -338,18 +339,14 @@ class Contact < ActiveRecord::Base destroy end - def val_upcase_country_code - if code = Country.new(ident_country_code) - self.ident_country_code = code.alpha2 - else - errors.add(:ident, :invalid_country_code) - end if ident_country_code_changed? && ident_country_code.present? + def to_upcase_country_code + self.ident_country_code = ident_country_code.upcase if ident_country_code + self.country_code = country_code.upcase if country_code + end - if code = Country.new(country_code) - self.country_code = code.alpha2 - else - errors.add(:country_code, :invalid_country_code) - end + def val_country_code + errors.add(:ident, :invalid_country_code) unless Country.new(ident_country_code) + errors.add(:ident, :invalid_country_code) unless Country.new(country_code) end def related_domain_descriptions From 8867644f169f72f1e0a16bd0da96e91f6ea78ee9 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 13 Mar 2016 15:08:03 +0200 Subject: [PATCH 036/247] 108869472-styles --- app/views/admin/domain_versions/show.haml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 81c144c4c..1ccc89912 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,12 +1,5 @@ -- content_for :actions do - = link_to(t(:previous), admin_domain_path(@version.item_id), class: 'btn btn-primary') - = link_to(t(:next), admin_domain_path(@version.item_id), method: :get, class: 'btn btn btn-default') - = render 'shared/title', name: @version.reify.name - - - - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.where(id: children[:nameservers]) @@ -67,6 +60,14 @@ %br %dt= t(:registrar) %dd= @version.reify.registrar.name + %span{:style => "padding-right:10px; float: right; bottom: 10px;"} + = link_to(t(:previous), + admin_domain_path(@version.item_id), + class: 'btn btn-primary') + = link_to(t(:next), + admin_domain_path(@version.item_id), + class: 'btn btn-default') + .col-md-4 .panel.panel-default{:style => "min-height:400px;"} %ul.nav.nav-pills.nav-stacked @@ -81,5 +82,5 @@ = link_to admin_domain_version_path(vs.id) do = l(vs.reify.updated_at, format: :short) = vs.event - %span{:style => "padding-left:10px;position: absolute; bottom: 10px;"} + %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} = paginate @versions From a42049e17060980350019d7d1b4f8fb50a7f81d9 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 14 Mar 2016 13:54:00 +0200 Subject: [PATCH 037/247] 108869472-template_changes --- .../admin/contact_versions_controller.rb | 18 +++- app/views/admin/contact_versions/index.haml | 5 +- app/views/admin/contact_versions/show.haml | 96 +++++++++++++++++++ app/views/admin/domain_versions/archive.haml | 2 +- app/views/admin/domain_versions/show.haml | 22 +++-- config/locales/en.yml | 2 + 6 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 app/views/admin/contact_versions/show.haml diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index d6c7deb9e..59aedfcac 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -6,12 +6,18 @@ class Admin::ContactVersionsController < AdminController @q = ContactVersion.search(params[:q]) @versions = @q.result.page(params[:page]) + search_params = params[:q].deep_dup whereS = "1=1" - params[:q].each do |key, value| + search_params.each do |key, value| next if value.empty? - whereS += create_where_string(key, value) + case key + when 'event' + whereS += " AND event = '#{value}'" + else + whereS += create_where_string(key, value) + end end versions = ContactVersion.includes(:item).where(whereS) @@ -21,6 +27,14 @@ class Admin::ContactVersionsController < AdminController end + def show + per_page = 7 + @version = ContactVersion.find(params[:id]) + @q = ContactVersion.where(item_id: @version.item_id).search + @versions = @q.result.page(params[:page]) + @versions = @versions.per(per_page) + end + def search render json: ContactVersion.search_by_query(params[:q]) end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 2384503bd..f7602c565 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -23,6 +23,9 @@ .row .col-md-3 .col-md-3 + .form-group + = label_tag :action + = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } .col-md-3 .form-group = label_tag t(:results_per_page) @@ -60,7 +63,7 @@ %tbody - @versions.each do |version| %tr - %td= version.reify.name + %td= link_to(version.reify.name, admin_contact_version_path(version.id)) %td= version.reify.code %td= ident_for(version.reify) %td= version.reify.phone diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml new file mode 100644 index 000000000..13aeb327a --- /dev/null +++ b/app/views/admin/contact_versions/show.haml @@ -0,0 +1,96 @@ += render 'shared/title', name: @version.reify.name + +.row + .col-md-8 + .panel.panel-default{:style => "min-height:420px;"} + .panel-heading + %h3.panel-title + = l(@version.reify.updated_at, format: :short) + = @version.event + = plain_username(@version.terminator) + .panel-body + %dl.dl-horizontal + %dt= t(:id) + %dd= @version.reify.code + + %dt= t(:ident) + %dd= ident_for(@version.reify) + + %dt= t(:email) + %dd= @version.reify.email + + %dt= t(:phone) + %dd= @version.reify.phone + + - if @version.reify.fax + %dt= t(:fax) + %dd= @version.reify.fax + + %br + + %dt= t(:created) + %dd + = l(@version.reify.created_at, format: :short) + + %dt= t(:updated) + %dd + = l(@version.reify.updated_at, format: :short) + + %dt= t(:registrar) + %dd + - if @version.reify.registrar.present? + = link_to(@version.reify.registrar, admin_registrar_path(@version.reify.registrar)) + + %dl.dl-horizontal + - if @version.reify.org_name.present? + %dt= t(:org_name) + %dd= @version.reify.org_name + + %dt= t(:street) + %dd= @version.reify.street.to_s.gsub("\n", '
').html_safe + + %dt= t(:city) + %dd= @version.reify.city + + %dt= t(:zip) + %dd= @version.reify.zip + + %dt= t(:state) + %dd= @version.reify.state + + %dt= t(:country) + %dd= @version.reify.country + + + %span{:style => "padding-right:10px; float: right;"} + - if @version.previous + = link_to(t(:previous), + admin_contact_version_path(@version.previous.id), + class: 'btn btn-primary') + - else + %a.btn.btn-primary.disabled{:href => "#"} + %span= t(:previous) + - if @version.next + = link_to(t(:next), + admin_contact_version_path(@version.next.id), + class: 'btn btn-default') + - else + %a.btn.btn-default.disabled{:href => "#"} + %span= t(:next) + + .col-md-4 + .panel.panel-default{:style => "min-height:420px;"} + %ul.nav.nav-pills.nav-stacked + - @versions.each do |vs| + - if vs.id == @version.id + %li.active + = link_to admin_contact_version_path(vs.id) do + = l(vs.reify.updated_at, format: :short) + = vs.event + - else + %li + = link_to admin_contact_version_path(vs.id) do + = l(vs.reify.updated_at, format: :short) + = vs.event + %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} + = paginate @versions \ No newline at end of file diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 94ed66658..6a8df123c 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -19,7 +19,7 @@ .col-md-3 .form-group = label_tag :action - = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } + = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } .row .col-md-3 .col-md-3 diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 1ccc89912..5b11d15fb 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -60,13 +60,21 @@ %br %dt= t(:registrar) %dd= @version.reify.registrar.name - %span{:style => "padding-right:10px; float: right; bottom: 10px;"} - = link_to(t(:previous), - admin_domain_path(@version.item_id), - class: 'btn btn-primary') - = link_to(t(:next), - admin_domain_path(@version.item_id), - class: 'btn btn-default') + %span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"} + - if @version.previous + = link_to(t(:previous), + admin_domain_version_path(@version.previous.id), + class: 'btn btn-primary') + - else + %a.btn.btn-primary.disabled{:href => "#"} + %span= t(:previous) + - if @version.next + = link_to(t(:next), + admin_domain_version_path(@version.next.id), + class: 'btn btn-default') + - else + %a.btn.btn-default.disabled{:href => "#"} + %span= t(:next) .col-md-4 .panel.panel-default{:style => "min-height:400px;"} diff --git a/config/locales/en.yml b/config/locales/en.yml index 16e643b16..a5d441e2e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -926,3 +926,5 @@ en: if_auth_info_is_left_empty_it_will_be_auto_generated: 'If auth info is left empty, it will be auto generated.' each_domain_name_must_end_with_colon_sign: 'Each domain name must end with colon (:) sign.' expiration_remind_subject: 'The %{name} domain has expired' + next: 'Next' + previous: 'Previous' From 03b58f738612f418c4263b860105029c875c1d03 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 14 Mar 2016 17:56:31 +0200 Subject: [PATCH 038/247] Story#115405945 - clean_pendings_lowlevel saves history --- app/models/domain.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index ff51f6f08..27c061770 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -345,7 +345,8 @@ class Domain < ActiveRecord::Base end - # state change shouln't be + # state changes may be done low-level - no validation + # in this metod we still save PaperTrail log. def clean_pendings_lowlevel statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) statuses.delete(DomainStatus::PENDING_UPDATE) @@ -354,13 +355,21 @@ class Domain < ActiveRecord::Base status_notes[DomainStatus::PENDING_UPDATE] = '' status_notes[DomainStatus::PENDING_DELETE] = '' - update_columns( + hash = { registrant_verification_token: nil, registrant_verification_asked_at: nil, pending_json: {}, status_notes: status_notes, statuses: statuses.presence || [DomainStatus::OK] - ) + } + + # papertrail + self.attributes = hash + record_create + clear_version_instance! + reset_transaction_id + + update_columns(hash) end def pending_update! From 35e7055c7ba4bde7ab5d347b48ea6ce2fc7f5000 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 15 Mar 2016 13:01:25 +0200 Subject: [PATCH 039/247] 110687814-update_point_changed --- app/models/epp/domain.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index b92a33e5a..737a434d6 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -489,14 +489,13 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] - self.upid = current_user.id if current_user - self.up_date = Time.zone.now - if errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes' registrant_verification_asked!(frame.to_s, current_user.id) + self.upid = current_user.registrar.id if current_user.registrar + self.up_date = Time.zone.now end self.deliver_emails = true # turn on email delivery for epp From d703cac62dae4f9c0d346416a1a26f4dc144a983 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 15 Mar 2016 15:20:08 +0200 Subject: [PATCH 040/247] Story#115405945 - on remove pending state create update history record --- 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 27c061770..28cf46041 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -365,7 +365,7 @@ class Domain < ActiveRecord::Base # papertrail self.attributes = hash - record_create + record_update clear_version_instance! reset_transaction_id From 518b7139f0f235a17b33399aba1b5f1397b7c498 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 16 Mar 2016 11:46:47 +0200 Subject: [PATCH 041/247] 108869472-conditions_for_corrupted --- app/views/admin/contact_versions/index.haml | 21 ++++++++++---------- app/views/admin/domain_versions/archive.haml | 21 ++++++++++---------- app/views/admin/domain_versions/show.haml | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index f7602c565..68e74c547 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -62,16 +62,17 @@ = t(:action) %tbody - @versions.each do |version| - %tr - %td= link_to(version.reify.name, admin_contact_version_path(version.id)) - %td= version.reify.code - %td= ident_for(version.reify) - %td= version.reify.phone - %td - - if version.reify.registrar - = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) - %td= l(version.created_at, format: :short) - %td= version.event + - if version.reify + %tr + %td= link_to(version.reify.name, admin_contact_version_path(version.id)) + %td= version.reify.code + %td= ident_for(version.reify) + %td= version.reify.phone + %td + - if version.reify.registrar + = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + %td= l(version.created_at, format: :short) + %td= version.event .row diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 6a8df123c..f50f18d06 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -55,16 +55,17 @@ = t(:action) %tbody - @versions.each do |version| - %tr - %td= link_to(version.reify.name, admin_domain_version_path(version.id)) - %td - - if version.reify.registrant - = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) - %td - - if version.reify.registrar - = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) - %td= l(version.created_at, format: :short) - %td= version.event + - if version.reify + %tr + %td= link_to(version.reify.name, admin_domain_version_path(version.id)) + %td + - if version.reify.registrant + = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) + %td + - if version.reify.registrar + = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + %td= l(version.created_at, format: :short) + %td= version.event .row diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 5b11d15fb..eeabed897 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -80,7 +80,7 @@ .panel.panel-default{:style => "min-height:400px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| - - if vs.id == @version.id + - if vs.id == @version.id and vs.reify %li.active = link_to admin_domain_version_path(vs.id) do = l(vs.reify.updated_at, format: :short) From 7ba760a884ddb579eace7b78b8e048062db4d143 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 16 Mar 2016 18:09:53 +0200 Subject: [PATCH 042/247] 108869472-changes_for_real_data --- app/controllers/admin/contact_versions_controller.rb | 2 +- app/controllers/admin/domain_versions_controller.rb | 10 +++++----- app/views/admin/contact_versions/show.haml | 6 +++--- app/views/admin/domain_versions/show.haml | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index 59aedfcac..215d6203c 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -30,7 +30,7 @@ class Admin::ContactVersionsController < AdminController def show per_page = 7 @version = ContactVersion.find(params[:id]) - @q = ContactVersion.where(item_id: @version.item_id).search + @q = ContactVersion.where(item_id: @version.item_id).order(created_at: :asc).search @versions = @q.result.page(params[:page]) @versions = @versions.per(per_page) end diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 4a309e9af..0d85e047f 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -9,12 +9,12 @@ class Admin::DomainVersionsController < AdminController search_params = params[:q].deep_dup if search_params[:registrant] - registrant = Contact.find_by_name(search_params[:registrant]) + registrant = Contact.find_by(name: search_params[:registrant]) search_params.delete(:registrant) end if search_params[:registrar] - registrar = Registrar.find_by_name(search_params[:registrar]) + registrar = Registrar.find_by(name: search_params[:registrar]) search_params.delete(:registrar) end @@ -30,8 +30,8 @@ class Admin::DomainVersionsController < AdminController end end - whereS += " AND object->>'registrant_id' ~ '#{registrant.id}'" if registrant - whereS += " AND object->>'registrar_id' ~ '#{registrar.id}'" if registrar + whereS += " AND object->>'registrant_id' = '#{registrant.id}'" if registrant + whereS += " AND object->>'registrar_id' = '#{registrar.id}'" if registrar versions = DomainVersion.includes(:item).where(whereS) @q = versions.search(params[:q]) @@ -44,7 +44,7 @@ class Admin::DomainVersionsController < AdminController def show per_page = 7 @version = DomainVersion.find(params[:id]) - @q = DomainVersion.where(item_id: @version.item_id).search + @q = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc).search @versions = @q.result.page(params[:page]) @versions = @versions.per(per_page) end diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 13aeb327a..555c301dc 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -5,7 +5,7 @@ .panel.panel-default{:style => "min-height:420px;"} .panel-heading %h3.panel-title - = l(@version.reify.updated_at, format: :short) + = l(@version.created_at, format: :short) = @version.event = plain_username(@version.terminator) .panel-body @@ -85,12 +85,12 @@ - if vs.id == @version.id %li.active = link_to admin_contact_version_path(vs.id) do - = l(vs.reify.updated_at, format: :short) + = l(vs.created_at, format: :short) = vs.event - else %li = link_to admin_contact_version_path(vs.id) do - = l(vs.reify.updated_at, format: :short) + = l(vs.created_at, format: :short) = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} = paginate @versions \ No newline at end of file diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index eeabed897..e6076a3db 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -15,7 +15,7 @@ .panel.panel-default{:style => "min-height:400px;"} .panel-heading %h3.panel-title - = l(@version.reify.updated_at, format: :short) + = l(@version.created_at, format: :short) = event = creator .panel-body @@ -83,12 +83,12 @@ - if vs.id == @version.id and vs.reify %li.active = link_to admin_domain_version_path(vs.id) do - = l(vs.reify.updated_at, format: :short) + = l(vs.created_at, format: :short) = vs.event - else %li = link_to admin_domain_version_path(vs.id) do - = l(vs.reify.updated_at, format: :short) + = l(vs.created_at, format: :short) = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} = paginate @versions From 92bc47adfa9488e82f6f6aafe81e6278863607eb Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 17 Mar 2016 12:49:00 +0200 Subject: [PATCH 043/247] Story#115405945 - papertrail saves new time as record itself --- app/models/domain.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 28cf46041..a71a06467 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -360,10 +360,12 @@ class Domain < ActiveRecord::Base registrant_verification_asked_at: nil, pending_json: {}, status_notes: status_notes, - statuses: statuses.presence || [DomainStatus::OK] + statuses: statuses.presence || [DomainStatus::OK], + # need this column in order to update PaperTrail version properly + updated_at: Time.now.utc } - # papertrail + # PaperTrail self.attributes = hash record_update clear_version_instance! From 431eaf54392dead044fe33c8a624818f43a7fcfc Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 17 Mar 2016 18:32:55 +0200 Subject: [PATCH 044/247] 1150040781-contact_delete_legal_doc --- app/controllers/epp/contacts_controller.rb | 2 +- app/models/contact.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 5b0a39bbf..0a8c8f634 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -39,7 +39,7 @@ class Epp::ContactsController < EppController def delete authorize! :delete, @contact, @password - if @contact.destroy_and_clean + if @contact.destroy_and_clean(params[:parsed_frame]) render_epp_response '/epp/contacts/delete' else handle_errors(@contact) diff --git a/app/models/contact.rb b/app/models/contact.rb index 9b4902e0b..d01bac152 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -330,11 +330,15 @@ class Contact < ActiveRecord::Base # TODO: refactor, it should not allow to destroy with normal destroy, # no need separate method # should use only in transaction - def destroy_and_clean + def destroy_and_clean frame if domains_present? errors.add(:domains, :exist) return false end + if doc = Epp::Contact.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) + frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? + self.legal_document_id = doc.id + end destroy end From 14b246d6922972d83c111a4de81526deb8d8baaa Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 18 Mar 2016 14:43:21 +0200 Subject: [PATCH 045/247] Story#111864739 - do not throw an error. --- app/models/epp/contact.rb | 1 - app/models/epp/domain.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index e3b972394..145e0fd27 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -235,7 +235,6 @@ class Epp::Contact < Contact document_type: legal_document_data[:type], body: legal_document_data[:body] ) - raise ActiveRecord::Rollback if doc && doc.id.nil? self.legal_documents = [doc] frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 1ee8a2d92..ca052bfeb 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -210,7 +210,6 @@ class Epp::Domain < Domain document_type: legal_document_data[:type], body: legal_document_data[:body] ) - raise ActiveRecord::Rollback if doc && doc.id.nil? self.legal_documents = [doc] frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? From 71aae06dd14a956bec4ae6662ae0e10975314d39 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 18 Mar 2016 15:59:14 +0200 Subject: [PATCH 046/247] Story#111864739 - epp validation --- app/models/legal_document.rb | 18 ++++++++++++++++++ config/locales/en.yml | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index 5aef34675..32ed8e61b 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -1,4 +1,7 @@ class LegalDocument < ActiveRecord::Base + include EppErrors + MIN_BODY_SIZE = (1.37 * 8.kilobytes).ceil + if ENV['legal_document_types'].present? TYPES = ENV['legal_document_types'].split(',').map(&:strip) else @@ -9,9 +12,24 @@ class LegalDocument < ActiveRecord::Base belongs_to :documentable, polymorphic: true + + validate :val_body_length, if: ->(file){ file.path.blank? && !Rails.env.staging?} + before_create :add_creator before_save :save_to_filesystem + def epp_code_map + { + '2306' => [ + [:body, :length] + ] + } + end + + def val_body_length + errors.add(:body, :length) if body.nil? || body.size < MIN_BODY_SIZE + end + def save_to_filesystem diff --git a/config/locales/en.yml b/config/locales/en.yml index 2cc8b1387..ad662277d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -205,6 +205,10 @@ en: blank: 'Algorithm is missing' auth_info_pw: blank: 'Password is missing' + legal_document: + attributes: + body: + length: 'Parameter value policy error: legalDocument size should be more than 8kB' attributes: From ed17431ebc89d6f6a9b99d14920343c92c23b2de Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 21 Mar 2016 15:17:00 +0200 Subject: [PATCH 047/247] 110687814-values_for_pending_apply --- app/models/epp/domain.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 737a434d6..d687137a6 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -511,6 +511,8 @@ class Epp::Domain < Domain self.deliver_emails = true # turn on email delivery self.statuses.delete(DomainStatus::PENDING_UPDATE) + self.upid = user.registrar.id if user.registrar + self.up_date = Time.zone.now ::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user send_mail :registrant_updated_notification_for_old_registrant From 779a47c80fe00b263e82d330a6407ba286f9a52f Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 22 Mar 2016 11:43:24 +0200 Subject: [PATCH 048/247] Story#105842700 - found some way how to load historical objects. Data will be extracted --- .../admin/domain_versions_controller.rb | 12 +-- app/views/admin/domain_versions/_version.haml | 78 +++++++++---------- 2 files changed, 39 insertions(+), 51 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 44a2087cd..9f8823d58 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,18 +1,8 @@ class Admin::DomainVersionsController < AdminController load_and_authorize_resource - # rubocop:disable Style/GuardClause def index - @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first + @domain = Domain.where(id: params[:domain_id]).includes(versions: :item).first @versions = @domain.versions - - # Depricated it had to load legal document. We may do it by parsing and adding link. - # if @domain.pending_json.present? - # frame = Nokogiri::XML(@domain.pending_json['frame']) - # @pending_user = User.find(@domain.pending_json['current_user_id']) - # @pending_domain = Epp::Domain.find(@domain.id) - # @pending_domain.update(frame, @pending_user, false) - # end end - # rubocop:enable Style/GuardClause end diff --git a/app/views/admin/domain_versions/_version.haml b/app/views/admin/domain_versions/_version.haml index 321e9abda..53d97059e 100644 --- a/app/views/admin/domain_versions/_version.haml +++ b/app/views/admin/domain_versions/_version.haml @@ -5,20 +5,21 @@ - if domain.present? - if version # normal history - - children = HashWithIndifferentAccess.new(version.children) - - nameservers = Nameserver.where(id: children[:nameservers]) - - tech_contacts = Contact.where(id: children[:tech_contacts]) - - admin_contacts = Contact.where(id: children[:admin_contacts]) - - registrant = Contact.where(id: children[:registrant]) - - event = version.event - - creator = plain_username(version.terminator) + - children = HashWithIndifferentAccess.new(version.children) + - nameservers = NameserverVersion.where(item_id: children[:nameservers]).order(:item_id).preceding(version.created_at + 1, true).select("distinct on (item_id) #{NameserverVersion.table_name}.*").map{|ver| o=Nameserver.new(ver.object); ver.object_changes.to_h.each{|k,v| o[k]=v[-1] };o } + -#- nameservers = children[:nameservers].map{|id| Nameserver.new(id: id).safe_version_at(version.created_at)} + - tech_contacts = Contact.where(id: children[:tech_contacts]).map{|o| o.safe_version_at(version.created_at)} + - admin_contacts = Contact.where(id: children[:admin_contacts]).map{|o| o.safe_version_at(version.created_at)} + - registrant = Contact.where(id: children[:registrant]).map{|o| o.safe_version_at(version.created_at)} + - event = version.event + - creator = plain_username(version.terminator) - else # pending history - nameservers = domain.nameservers - tech_contacts = domain.tech_contacts - admin_contacts = domain.admin_contacts - - registrant = [domain.registrant] - - creator = pending_user.try(:username) - - event = 'pending' + - registrant = [domain.registrant] + - creator = pending_user.try(:username) + - event = 'pending' %td %p.nowrap @@ -55,43 +56,40 @@ = "#{l(domain.valid_to, format: :date)}" %td - - if registrant - - registrant.each do |r| - %p - = r[:name] - = r[:phone] - = r[:email] - %p - = r[:code] + - Array(registrant).each do |r| + %p + = r[:name] + = r[:phone] + = r[:email] + %p + = r[:code] %td - - if admin_contacts - - admin_contacts.each do |ac| - %p - = ac[:name] - = ac[:phone] - = ac[:email] - %p - = ac[:code] + - Array(admin_contacts).each do |ac| + %p + = ac[:name] + = ac[:phone] + = ac[:email] + %p + = ac[:code] %td - - if tech_contacts - - tech_contacts.each do |tc| - %p - = tc[:name] - = tc[:phone] - = tc[:email] - %p - = tc[:code] + - Array(tech_contacts).each do |tc| + %p + = tc[:name] + = tc[:phone] + = tc[:email] + %p + = tc[:code] %td %p - - if nameservers - - nameservers.each do |ns| - = ns[:hostname] - %br - = ns[:ipv4] - = ns[:ipv6] + - Array(nameservers).each do |ns| + = ns[:hostname] + %br + = ns[:ipv4] + = ns[:ipv6] + %br %td %p From 028aa31232ce6ca8c244703edd6ce179e010a097 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 22 Mar 2016 15:17:36 +0200 Subject: [PATCH 049/247] Story#115762063 - all contacts are using the same versions logic --- app/models/concerns/versions.rb | 18 ++++++++++++++++++ app/views/admin/domain_versions/_version.haml | 13 ++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index 768cf021e..9af2b3640 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -55,4 +55,22 @@ module Versions domains.each(&:touch_with_version) end end + + module ClassMethods + def all_versions_for(ids, time) + ver_klass = paper_trail_version_class + from_history = ver_klass.where(item_id: ids). + order(:item_id). + preceding(time + 1, true). + select("distinct on (item_id) #{ver_klass.table_name}.*"). + map do |ver| + o = new(ver.object) + ver.object_changes.to_h.each { |k, v| o[k]=v[-1] } + o + end + not_in_history = where(id: (ids - from_history.map(&:id))) + + from_history + not_in_history + end + end end diff --git a/app/views/admin/domain_versions/_version.haml b/app/views/admin/domain_versions/_version.haml index 53d97059e..47a2e597b 100644 --- a/app/views/admin/domain_versions/_version.haml +++ b/app/views/admin/domain_versions/_version.haml @@ -6,11 +6,10 @@ - if domain.present? - if version # normal history - children = HashWithIndifferentAccess.new(version.children) - - nameservers = NameserverVersion.where(item_id: children[:nameservers]).order(:item_id).preceding(version.created_at + 1, true).select("distinct on (item_id) #{NameserverVersion.table_name}.*").map{|ver| o=Nameserver.new(ver.object); ver.object_changes.to_h.each{|k,v| o[k]=v[-1] };o } - -#- nameservers = children[:nameservers].map{|id| Nameserver.new(id: id).safe_version_at(version.created_at)} - - tech_contacts = Contact.where(id: children[:tech_contacts]).map{|o| o.safe_version_at(version.created_at)} - - admin_contacts = Contact.where(id: children[:admin_contacts]).map{|o| o.safe_version_at(version.created_at)} - - registrant = Contact.where(id: children[:registrant]).map{|o| o.safe_version_at(version.created_at)} + - nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at) + - tech_contacts = Contact.all_versions_for(children[:tech_contacts], version.created_at) + - admin_contacts = Contact.all_versions_for(children[:admin_contacts], version.created_at) + - registrant = Contact.all_versions_for(children[:registrant], version.created_at) - event = version.event - creator = plain_username(version.terminator) - else # pending history @@ -87,8 +86,8 @@ - Array(nameservers).each do |ns| = ns[:hostname] %br - = ns[:ipv4] - = ns[:ipv6] + = ns[:ipv4].presence + = ns[:ipv6].presence %br %td From 92b64d6268f167de88d9391fae772b9464d1c1f8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 22 Mar 2016 15:53:47 +0200 Subject: [PATCH 050/247] Story#115762063 - add links to versions list --- app/views/admin/domain_versions/_version.haml | 49 ++++++++++--------- app/views/admin/domain_versions/index.haml | 4 +- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/app/views/admin/domain_versions/_version.haml b/app/views/admin/domain_versions/_version.haml index 47a2e597b..7ef1dc182 100644 --- a/app/views/admin/domain_versions/_version.haml +++ b/app/views/admin/domain_versions/_version.haml @@ -31,7 +31,7 @@ %br = creator - %td + %td{class: version && version.object_changes.to_h["statuses"] && "warning"} %p - if domain.statuses.present? - domain.statuses.each do |s| @@ -46,7 +46,7 @@ %p = link_to t(:pending_epp), '#', class: 'js-pending-toggle' - %td + %td{class: version && version.object_changes.to_h.slice("period", "period_unit", "valid_from", "valid_to").any? && "warning"} %p = "#{domain.period}#{domain.period_unit}" %br @@ -56,30 +56,33 @@ %td - Array(registrant).each do |r| - %p - = r[:name] - = r[:phone] - = r[:email] - %p - = r[:code] + = link_to admin_contact_path(r.id), target: "contact_#{r.id}" do + %p + = r[:name] + = r[:phone] + = r[:email] + %p + = r[:code] %td - Array(admin_contacts).each do |ac| - %p - = ac[:name] - = ac[:phone] - = ac[:email] - %p - = ac[:code] + = link_to admin_contact_path(ac.id), target: "contact_#{ac.id}" do + %p + = ac[:name] + = ac[:phone] + = ac[:email] + %p + = ac[:code] %td - Array(tech_contacts).each do |tc| - %p - = tc[:name] - = tc[:phone] - = tc[:email] - %p - = tc[:code] + = link_to admin_contact_path(tc.id), target: "contact_#{tc.id}" do + %p + = tc[:name] + = tc[:phone] + = tc[:email] + %p + = tc[:code] %td %p @@ -91,8 +94,10 @@ %br %td - %p - = domain.registrar.name if domain.registrar + - if domain.registrar + %p + = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do + = domain.registrar.name - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } diff --git a/app/views/admin/domain_versions/index.haml b/app/views/admin/domain_versions/index.haml index d948d53df..7717d16de 100644 --- a/app/views/admin/domain_versions/index.haml +++ b/app/views/admin/domain_versions/index.haml @@ -5,7 +5,7 @@ .row .col-md-12 .table-responsive - %table.table-hover.table-bordered.table-condensed + %table.table.table-bordered.table-condensed %thead %tr %th{class: 'col-xs-1'}= t(:timestap) @@ -26,7 +26,7 @@ -# current version - if @domain.versions.present? %tr.small - = render 'admin/domain_versions/version', + = render 'admin/domain_versions/version', domain: @domain, version: @domain.versions.last -# all other older versions From 0dc1442c1a50462026ae20392a30de444323d662 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 22 Mar 2016 18:37:19 +0200 Subject: [PATCH 051/247] 10886972-dublicate_view_deleted --- app/views/admin/domain_versions/_version.haml | 105 ------------------ 1 file changed, 105 deletions(-) delete mode 100644 app/views/admin/domain_versions/_version.haml diff --git a/app/views/admin/domain_versions/_version.haml b/app/views/admin/domain_versions/_version.haml deleted file mode 100644 index fd449b4b0..000000000 --- a/app/views/admin/domain_versions/_version.haml +++ /dev/null @@ -1,105 +0,0 @@ -- statuses_link ||= false -- version ||= false -- domain ||= false -- pending_user ||= false - -- if domain.present? - - if version # normal history - - children = HashWithIndifferentAccess.new(version.children) - - nameservers = Nameserver.where(id: children[:nameservers]) - - tech_contacts = Contact.where(id: children[:tech_contacts]) - - admin_contacts = Contact.where(id: children[:admin_contacts]) - - registrant = Contact.where(id: children[:registrant]) - - event = version.event - - creator = plain_username(version.terminator) - - else # pending history - - nameservers = domain.nameservers - - tech_contacts = domain.tech_contacts - - admin_contacts = domain.admin_contacts - - registrant = [domain.registrant] - - creator = pending_user.try(:username) - - event = 'pending' - - %td - %p.nowrap - = l(domain.updated_at, format: :shorts) - - if statuses_link - %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) - - %p.text-right - = event - %br - = creator - - %td - %p - - if domain.statuses.present? - - domain.statuses.each do |s| - = s - - if domain.status_notes.present? - - notes = domain.status_notes[s] - - if notes - %br - %i= notes - %br - - if domain.pending_json.present? - %p - = link_to t(:pending_epp), '#', class: 'js-pending-toggle' - - %td - %p - = "#{domain.period}#{domain.period_unit}" - %br - = "#{l(domain.valid_from, format: :date)}" - %br - = "#{l(domain.valid_to, format: :date)}" - - %td - - registrant.each do |r| - %p - = r[:name] - = r[:phone] - = r[:email] - %p - = r[:code] - - %td - - admin_contacts.each do |ac| - %p - = ac[:name] - = ac[:phone] - = ac[:email] - %p - = ac[:code] - - %td - - tech_contacts.each do |tc| - %p - = tc[:name] - = tc[:phone] - = tc[:email] - %p - = tc[:code] - - %td - %p - - nameservers.each do |ns| - = ns[:hostname] - %br - = ns[:ipv4] - = ns[:ipv6] - - %td - %p - = domain.registrar.name - - - if domain.pending_json.present? - %tr.js-pending{ style: 'display: none;' } - %td{colspan: 8} - = preserve do - %pre - - formatted_req = Nokogiri::XML(domain.pending_json['frame']) - - if formatted_req.errors.none? - = formatted_req - - else - = domain.pending_json['frame'] From 7eeb889b2253f6e36880ebca9c53a29b8b5be7b3 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 22 Mar 2016 21:45:25 +0200 Subject: [PATCH 052/247] 108869472-old_template_delete --- app/views/admin/domain_versions/index.haml | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 app/views/admin/domain_versions/index.haml diff --git a/app/views/admin/domain_versions/index.haml b/app/views/admin/domain_versions/index.haml deleted file mode 100644 index d948d53df..000000000 --- a/app/views/admin/domain_versions/index.haml +++ /dev/null @@ -1,44 +0,0 @@ -- content_for :actions do - = link_to(t(:back_to_domain), [:admin, @domain], class: 'btn btn-default') -= render 'shared/title', name: "#{t(:history)}: #{@domain.name}" - -.row - .col-md-12 - .table-responsive - %table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-1'}= t(:timestap) - %th{class: 'col-xs-2'}= t(:statuses) - %th{class: 'col-xs-1'}= t(:period) - %th{class: 'col-xs-2'}= t(:registrant) - %th{class: 'col-xs-2'}= t(:admin) - %th{class: 'col-xs-2'}= t(:tech) - %th{class: 'col-xs-2'}= t(:nameservers) - %th{class: 'col-xs-2'}= t(:registrar) - - %tbody - - if @pending_domain.present? - %tr.small - = render 'admin/domain_versions/version', - domain: @pending_domain, pending_user: @pending_user, statuses_link: true - - -# current version - - if @domain.versions.present? - %tr.small - = render 'admin/domain_versions/version', - domain: @domain, version: @domain.versions.last - - -# all other older versions - - @domain.versions.not_creates.reverse.each do |version| - %tr.small - = render 'admin/domain_versions/version', - domain: version.reify, version: version.previous - -:coffee - $(document).on 'click', '.js-pending-toggle', (e) -> - e.preventDefault() - - $(document).on 'mousedown', '.js-pending-toggle', (e) -> - target = $(e.target) - target.parents('tr').next('tr.js-pending').toggle() From ffe2ddd02c075bc32163d2f0fbf795376721dff8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 22 Mar 2016 23:51:21 +0200 Subject: [PATCH 053/247] Merge remote-tracking branch 'origin/108869472-objects_archive' into story/115762063--show-historical-nested # Conflicts: # app/views/admin/domain_versions/_version.haml # app/views/admin/domain_versions/index.haml --- app/models/concerns/versions.rb | 2 + .../admin/domains/partials/_version.haml | 85 ++++++++++--------- app/views/admin/domains/versions.haml | 2 +- 3 files changed, 50 insertions(+), 39 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index 9af2b3640..779bd781a 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -3,6 +3,7 @@ module Versions extend ActiveSupport::Concern included do + attr_accessor :version_loader has_paper_trail class_name: "#{model_name}Version" # add creator and updator @@ -65,6 +66,7 @@ module Versions select("distinct on (item_id) #{ver_klass.table_name}.*"). map do |ver| o = new(ver.object) + o.version_loader = ver ver.object_changes.to_h.each { |k, v| o[k]=v[-1] } o end diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index fd449b4b0..e4b4c3c03 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -5,20 +5,20 @@ - if domain.present? - if version # normal history - - children = HashWithIndifferentAccess.new(version.children) - - nameservers = Nameserver.where(id: children[:nameservers]) - - tech_contacts = Contact.where(id: children[:tech_contacts]) - - admin_contacts = Contact.where(id: children[:admin_contacts]) - - registrant = Contact.where(id: children[:registrant]) - - event = version.event - - creator = plain_username(version.terminator) + - children = HashWithIndifferentAccess.new(version.children) + - nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at) + - tech_contacts = Contact.all_versions_for(children[:tech_contacts], version.created_at) + - admin_contacts = Contact.all_versions_for(children[:admin_contacts], version.created_at) + - registrant = Contact.all_versions_for(children[:registrant], version.created_at) + - event = version.event + - creator = plain_username(version.terminator) - else # pending history - nameservers = domain.nameservers - tech_contacts = domain.tech_contacts - admin_contacts = domain.admin_contacts - - registrant = [domain.registrant] - - creator = pending_user.try(:username) - - event = 'pending' + - registrant = [domain.registrant] + - creator = pending_user.try(:username) + - event = 'pending' %td %p.nowrap @@ -31,7 +31,7 @@ %br = creator - %td + %td{class: version && version.object_changes.to_h["statuses"] && "warning"} %p - if domain.statuses.present? - domain.statuses.each do |s| @@ -46,7 +46,7 @@ %p = link_to t(:pending_epp), '#', class: 'js-pending-toggle' - %td + %td{class: version && version.object_changes.to_h.slice("period", "period_unit", "valid_from", "valid_to").any? && "warning"} %p = "#{domain.period}#{domain.period_unit}" %br @@ -55,43 +55,52 @@ = "#{l(domain.valid_to, format: :date)}" %td - - registrant.each do |r| - %p - = r[:name] - = r[:phone] - = r[:email] - %p - = r[:code] + - Array(registrant).each do |r| + - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) + = link_to link, target: "contact_#{r.id}" do + %p + = r[:name] + = r[:phone] + = r[:email] + %p + = r[:code] %td - - admin_contacts.each do |ac| - %p - = ac[:name] - = ac[:phone] - = ac[:email] - %p - = ac[:code] + - Array(admin_contacts).each do |ac| + - link = ac.version_loader ? admin_contact_version_path(ac.version_loader.try(:id)) : admin_contact_path(ac.id) + = link_to link, target: "contact_#{ac.id}" do + %p + = ac[:name] + = ac[:phone] + = ac[:email] + %p + = ac[:code] %td - - tech_contacts.each do |tc| - %p - = tc[:name] - = tc[:phone] - = tc[:email] - %p - = tc[:code] + - Array(tech_contacts).each do |tc| + - link = tc.version_loader ? admin_contact_version_path(tc.version_loader.try(:id)) : admin_contact_path(tc.id) + = link_to link, target: "contact_#{tc.id}" do + %p + = tc[:name] + = tc[:phone] + = tc[:email] + %p + = tc[:code] %td %p - - nameservers.each do |ns| + - Array(nameservers).each do |ns| = ns[:hostname] %br - = ns[:ipv4] - = ns[:ipv6] + = ns[:ipv4].presence + = ns[:ipv6].presence + %br %td - %p - = domain.registrar.name + - if domain.registrar + %p + = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do + = domain.registrar.name - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index 5224aa34a..175b0be02 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -5,7 +5,7 @@ .row .col-md-12 .table-responsive - %table.table-hover.table-bordered.table-condensed + %table.table.table-bordered.table-condensed %thead %tr %th{class: 'col-xs-1'}= t(:timestap) From 306819eeaf0aa973d0a7707e0589cd27d470c6ab Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 23 Mar 2016 00:05:55 +0200 Subject: [PATCH 054/247] story#115762063 - add links to just domain version view --- app/views/admin/domain_versions/show.haml | 58 ++++++++++++++--------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index e6076a3db..ffd2b359a 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -2,12 +2,13 @@ - if @version - children = HashWithIndifferentAccess.new(@version.children) - - nameservers = Nameserver.where(id: children[:nameservers]) - - tech_contacts = Contact.where(id: children[:tech_contacts]) - - admin_contacts = Contact.where(id: children[:admin_contacts]) - - registrant = Contact.where(id: children[:registrant]) + - nameservers = Nameserver.all_versions_for(children[:nameservers], @version.created_at) + - tech_contacts = Contact.all_versions_for(children[:tech_contacts], @version.created_at) + - admin_contacts = Contact.all_versions_for(children[:admin_contacts], @version.created_at) + - registrant = Contact.all_versions_for(children[:registrant], @version.created_at) - event = @version.event - creator = plain_username(@version.terminator) + - domain = @version.reify .row @@ -22,35 +23,46 @@ %dl.dl-horizontal %dt= t(:name) %dd= link_to(@version.reify.name, admin_domain_path(@version.item_id)) + %dt= t(:statuses) - %dd + %dd{class: @version.object_changes.to_h["statuses"] && "text-warning"} - if @version.reify.statuses.present? - @version.reify.statuses.each do |s| = s + %dt= t(:registrant) - %dd + %dd{class: @version.object_changes.to_h["registrant_id"] && "text-warning"} - registrant.each do |r| - = r[:name] - = r[:phone] - = r[:email] - = r[:code] - %br + - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) + = link_to link, target: "contact_#{r.id}" do + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:admin_contacts) %dd - admin_contacts.each do |r| - = r[:name] - = r[:phone] - = r[:email] - = r[:code] - %br + - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) + = link_to link, target: "contact_#{r.id}" do + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:tech_contacts) %dd - tech_contacts.each do |r| - = r[:name] - = r[:phone] - = r[:email] - = r[:code] - %br + - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) + = link_to link, target: "contact_#{r.id}" do + = r[:name] + = r[:phone] + = r[:email] + = r[:code] + %br + %dt= t(:nameservers) %dd - nameservers.each do |ns| @@ -59,7 +71,9 @@ = ns[:ipv6] %br %dt= t(:registrar) - %dd= @version.reify.registrar.name + %dd{class: @version.object_changes.to_h["registrar_id"] && "text-warning"} + = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do + = @version.reify.registrar.name %span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"} - if @version.previous = link_to(t(:previous), From 61f08cda9a6e7cb37c8e1ad423ea7bd076e3ca27 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 23 Mar 2016 12:15:27 +0200 Subject: [PATCH 055/247] 111864739-method_scope_changed --- app/models/epp/contact.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 145e0fd27..c0952aadd 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -100,6 +100,16 @@ class Epp::Contact < Contact res end + + def attach_legal_document(legal_document_data) + return unless legal_document_data + + legal_documents.create( + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + end + end delegate :ident_attr_valid?, to: :class @@ -217,15 +227,6 @@ class Epp::Contact < Contact status_list end - def attach_legal_document(legal_document_data) - return unless legal_document_data - - legal_documents.create( - document_type: legal_document_data[:type], - body: legal_document_data[:body] - ) - end - def add_legal_file_to_new frame legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) return unless legal_document_data From 667ce870787578c8028d2f74dcf4320258f0ce7e Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 23 Mar 2016 18:17:05 +0200 Subject: [PATCH 056/247] 111864739-revert_scope --- app/models/epp/contact.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index c0952aadd..52e32da11 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -101,15 +101,6 @@ class Epp::Contact < Contact res end - def attach_legal_document(legal_document_data) - return unless legal_document_data - - legal_documents.create( - document_type: legal_document_data[:type], - body: legal_document_data[:body] - ) - end - end delegate :ident_attr_valid?, to: :class @@ -227,6 +218,15 @@ class Epp::Contact < Contact status_list end + def attach_legal_document(legal_document_data) + return unless legal_document_data + + legal_documents.create( + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + end + def add_legal_file_to_new frame legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) return unless legal_document_data From bcc8e7b6f81309e8c75f13e78b064bbdcd7316ee Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 23 Mar 2016 18:28:40 +0200 Subject: [PATCH 057/247] story#115762063 - use special helper method to generate class name --- app/helpers/application_helper.rb | 11 ++++ app/models/domain.rb | 3 +- app/views/admin/contact_versions/show.haml | 53 +++++++++++-------- app/views/admin/domain_versions/show.haml | 19 ++++--- .../admin/domains/partials/_version.haml | 6 +-- 5 files changed, 59 insertions(+), 33 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 098c10d9b..7cee5b69e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -72,4 +72,15 @@ module ApplicationHelper link_to(title, url_for(sort: {param_name => order}), class: "sort_link #{order}") end + + def changing_css_class(version, *attrs) + return unless version + css_class = "text-warning" + + if attrs.size == 1 + version.object_changes.to_h[attrs.first] && css_class + else + version.object_changes.to_h.slice(*attrs).any? && css_class + end + end end diff --git a/app/models/domain.rb b/app/models/domain.rb index ff51f6f08..dded56a3f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -731,7 +731,8 @@ class Domain < ActiveRecord::Base log[:tech_contacts] = tech_contact_ids log[:nameservers] = nameserver_ids log[:registrant] = [registrant_id] - log[:domain_statuses] = domain_status_ids + log[:domain_statuses]= domain_status_ids + log[:dnskeys] = dnskeys_ids log end diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 555c301dc..d6762a8c6 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -1,4 +1,6 @@ -= render 'shared/title', name: @version.reify.name +- contact = Contact.new(@version.object.to_h) +- @version.object_changes.to_h.each{|k,v| contact[k]=v.last} += render 'shared/title', name: contact.name .row .col-md-8 @@ -11,55 +13,64 @@ .panel-body %dl.dl-horizontal %dt= t(:id) - %dd= @version.reify.code + %dd{class: changing_css_class(@version,"code")} + = contact.code + + %dt= t(:statuses) + %dd{class: changing_css_class(@version,"statuses")} + = contact.statuses.join(", ") %dt= t(:ident) - %dd= ident_for(@version.reify) + %dd{class: changing_css_class(@version,"ident_country_code", "ident_type", "ident")} + = ident_for(contact) %dt= t(:email) - %dd= @version.reify.email + %dd{class: changing_css_class(@version,"email")} + = contact.email %dt= t(:phone) - %dd= @version.reify.phone + %dd{class: changing_css_class(@version,"phone")} + = contact.phone - - if @version.reify.fax + - if contact.fax %dt= t(:fax) - %dd= @version.reify.fax + %dd{class: changing_css_class(@version,"fax")} + = contact.fax %br %dt= t(:created) - %dd - = l(@version.reify.created_at, format: :short) + %dd{class: changing_css_class(@version,"created_at")} + = l(contact.created_at, format: :short) %dt= t(:updated) - %dd - = l(@version.reify.updated_at, format: :short) + %dd{class: changing_css_class(@version,"updated_at")} + = l(contact.updated_at, format: :short) %dt= t(:registrar) - %dd - - if @version.reify.registrar.present? - = link_to(@version.reify.registrar, admin_registrar_path(@version.reify.registrar)) + %dd{class: changing_css_class(@version,"registrar_id")} + - if contact.registrar.present? + = link_to(contact.registrar, admin_registrar_path(contact.registrar)) %dl.dl-horizontal - - if @version.reify.org_name.present? + - if contact.org_name.present? %dt= t(:org_name) - %dd= @version.reify.org_name + %dd{class: changing_css_class(@version,"org_name")}= contact.org_name %dt= t(:street) - %dd= @version.reify.street.to_s.gsub("\n", '
').html_safe + %dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '
').html_safe %dt= t(:city) - %dd= @version.reify.city + %dd{class: changing_css_class(@version,"city")}= contact.city %dt= t(:zip) - %dd= @version.reify.zip + %dd{class: changing_css_class(@version,"zip")}= contact.zip %dt= t(:state) - %dd= @version.reify.state + %dd{class: changing_css_class(@version,"state")}= contact.state %dt= t(:country) - %dd= @version.reify.country + %dd{class: changing_css_class(@version,"country_code")}= contact.country %span{:style => "padding-right:10px; float: right;"} diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index ffd2b359a..6244e60f0 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,4 +1,6 @@ = render 'shared/title', name: @version.reify.name +- domain = Domain.new(@version.object.to_h) +- @version.object_changes.to_h.each{|k,v| domain[k]=v.last} - if @version - children = HashWithIndifferentAccess.new(@version.children) @@ -8,7 +10,6 @@ - registrant = Contact.all_versions_for(children[:registrant], @version.created_at) - event = @version.event - creator = plain_username(@version.terminator) - - domain = @version.reify .row @@ -22,16 +23,16 @@ .panel-body %dl.dl-horizontal %dt= t(:name) - %dd= link_to(@version.reify.name, admin_domain_path(@version.item_id)) + %dd= link_to(domain.name, admin_domain_path(@version.item_id)) %dt= t(:statuses) - %dd{class: @version.object_changes.to_h["statuses"] && "text-warning"} - - if @version.reify.statuses.present? - - @version.reify.statuses.each do |s| + %dd{class: changing_css_class(@version,"statuses")} + - if domain.statuses.present? + - domain.statuses.each do |s| = s %dt= t(:registrant) - %dd{class: @version.object_changes.to_h["registrant_id"] && "text-warning"} + %dd{class: changing_css_class(@version,"registrant_id")} - registrant.each do |r| - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) = link_to link, target: "contact_#{r.id}" do @@ -70,10 +71,12 @@ = ns[:ipv4] = ns[:ipv6] %br + %dt= t(:registrar) - %dd{class: @version.object_changes.to_h["registrar_id"] && "text-warning"} + %dd{class: changing_css_class(@version,"registrar_id")} = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do - = @version.reify.registrar.name + = domain.registrar.name + %span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"} - if @version.previous = link_to(t(:previous), diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index e4b4c3c03..15768ea16 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -31,7 +31,7 @@ %br = creator - %td{class: version && version.object_changes.to_h["statuses"] && "warning"} + %td{class: changing_css_class(version,"statuses")} %p - if domain.statuses.present? - domain.statuses.each do |s| @@ -46,7 +46,7 @@ %p = link_to t(:pending_epp), '#', class: 'js-pending-toggle' - %td{class: version && version.object_changes.to_h.slice("period", "period_unit", "valid_from", "valid_to").any? && "warning"} + %td{class: changing_css_class(version, "period", "period_unit", "valid_from", "valid_to")} %p = "#{domain.period}#{domain.period_unit}" %br @@ -96,7 +96,7 @@ = ns[:ipv6].presence %br - %td + %td{class: changing_css_class(version,"registrar_id")} - if domain.registrar %p = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do From 4ab4ba6f975a04c1bb4724a34f0cc273dc7d7445 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 23 Mar 2016 18:55:04 +0200 Subject: [PATCH 058/247] Story#114871365 - add to country_code updater functionality to update it in log table --- lib/tasks/convert.rake | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index d55778ad9..c3976f2a0 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -41,12 +41,36 @@ namespace :convert do if c.country_code.present? && c.country_code != c.country_code.upcase c.country_code = c.country_code.upcase c.update_columns(country_code: c.country_code.upcase) - # c.send(:record_update) count +=1 puts "#{count} contacts has been changed" if count % 1000 == 0 end end + puts "Contacts change has been finished. Starting ContactVersions" + + count = 0 + ContactVersion.find_each do |c| + if if_object = (c.object && c.object["country_code"].present? && c.object["country_code"] != c.object["country_code"].upcase) || + if_changes = (c.object_changes && c.object_changes["country_code"].present? && c.object_changes["country_code"] != c.object_changes["country_code"].map{|e|e.try(:upcase)}) + + if if_object + h = c.object + h["country_code"] = h["country_code"].upcase + c.object = h + end + + if if_changes + h = c.object_changes + h["country_code"] = h["country_code"].map{|e|e.try(:upcase)} + c.object_changes = h + binding.pry + end + c.update_columns(object: c.object, object_changes: c.object_changes) + + count +=1 + puts "#{count} contact histories has been changed" if count % 1000 == 0 + end + end end end From 4e51adb08e2f5b02d75ce992ebdbe56a341cec79 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 24 Mar 2016 12:01:10 +0200 Subject: [PATCH 059/247] 115040781-legal_doc_check_and_save --- app/models/contact.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index d01bac152..3d4ca419c 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -335,9 +335,19 @@ class Contact < ActiveRecord::Base errors.add(:domains, :exist) return false end - if doc = Epp::Contact.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) - frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? - self.legal_document_id = doc.id + + legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) + + if legal_document_data + + doc = LegalDocument.create( + documentable_type: Contact, + document_type: legal_document_data[:type], + body: legal_document_data[:body] + ) + self.legal_documents = [doc] + self.legal_document_id = doc.id + self.save end destroy end From 2a7de9fbd6232d55a261ae4b7b6af199e335ff14 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 24 Mar 2016 15:32:44 +0200 Subject: [PATCH 060/247] Story#114871365 - fix imported old fred history --- lib/tasks/convert.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index c3976f2a0..7b5adb9a5 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -55,7 +55,7 @@ namespace :convert do if if_object h = c.object - h["country_code"] = h["country_code"].upcase + h["country_code"] = h["country_code"].try(:upcase) c.object = h end From 2b2e2e52543b641ec51743021d00641aad58b372 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 24 Mar 2016 15:47:07 +0200 Subject: [PATCH 061/247] Story#115762063 - typo --- 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 dded56a3f..29a53ead3 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -732,7 +732,7 @@ class Domain < ActiveRecord::Base log[:nameservers] = nameserver_ids log[:registrant] = [registrant_id] log[:domain_statuses]= domain_status_ids - log[:dnskeys] = dnskeys_ids + log[:dnskeys] = dnskey_ids log end From 21e74dce217d85ffdc0171b574249e2d514e5e2f Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 24 Mar 2016 16:33:32 +0200 Subject: [PATCH 062/247] 110687814-contact_value_modification --- app/models/epp/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 6a3540888..be4dfeaf9 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -178,7 +178,7 @@ class Epp::Contact < Contact end end - self.upid = current_user.id if current_user + self.upid = current_user.registrar.id if current_user.registrar self.up_date = Time.zone.now super(at) From 5c2033a8a81cde33ce0859f3f000baecfc6a4dd9 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 24 Mar 2016 17:31:17 +0200 Subject: [PATCH 063/247] 110687814-update_order_change --- app/models/epp/domain.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index d687137a6..d070da026 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -489,13 +489,16 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] + if erros.empty? && verify + self.upid = current_user.registrar.id if current_user.registrar + self.up_date = Time.zone.now + end + if errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes' registrant_verification_asked!(frame.to_s, current_user.id) - self.upid = current_user.registrar.id if current_user.registrar - self.up_date = Time.zone.now end self.deliver_emails = true # turn on email delivery for epp From b682deeb9e1ce151960f35208ba0790d93b6110f Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 28 Mar 2016 11:40:34 +0300 Subject: [PATCH 064/247] story#114871365 - revert prefix code name generation --- app/models/contact.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index baa51c19e..f06008495 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -41,7 +41,7 @@ class Contact < ActiveRecord::Base end before_validation :to_upcase_country_code - before_validation :val_prefix_code + before_validation :prefix_code before_create :generate_auth_info before_update :manage_emails @@ -299,7 +299,7 @@ class Contact < ActiveRecord::Base end # rubocop:disable Metrics/CyclomaticComplexity - def val_prefix_code + def prefix_code return nil unless new_record? return nil if registrar.blank? code = self[:code] From bd049968e13431131dec1f64d98321f3430b6e64 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 28 Mar 2016 20:16:27 +0300 Subject: [PATCH 065/247] story#115040421 - remove double save of legal doc on contact update --- app/models/epp/contact.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index c0952aadd..3a8cc83b9 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -157,8 +157,8 @@ class Epp::Contact < Contact at[:statuses] = statuses - statuses_attrs(frame.css('rem'), 'rem') + statuses_attrs(frame.css('add'), 'add') end - legal_frame = frame.css('legalDocument').first - at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame) + # legal_frame = frame.css('legalDocument').first + # at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame) if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? From 9875393b63f721e3e296c68ac1f85b0eebf8f568 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 29 Mar 2016 11:57:09 +0300 Subject: [PATCH 066/247] 110687814-typo --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index d070da026..c1274c02b 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -489,7 +489,7 @@ class Epp::Domain < Domain # at[:statuses] += at_add[:domain_statuses_attributes] - if erros.empty? && verify + if errors.empty? && verify self.upid = current_user.registrar.id if current_user.registrar self.up_date = Time.zone.now end From 0e35641702c542050ef97122a960ae8677a56994 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 29 Mar 2016 12:56:23 +0300 Subject: [PATCH 067/247] 115040781-translation_added --- config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 27495c382..30418d17a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -355,6 +355,7 @@ en: contact: 'Contact' credit_balance: 'Credit balance' starting_balance: 'Starting balance' + destroyed: 'Destroyed' domain_transfer_requested: 'Domain transfer requested!' domain_transfer_approved: 'Domain transfer approved!' From de5f06fa89796e8958d7e883a2deac841ebc3602 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 29 Mar 2016 17:03:07 +0300 Subject: [PATCH 068/247] 113430903-paper_trail_log_added --- app/jobs/domain_delete_job.rb | 1 + app/jobs/domain_set_delete_candidate_job.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/jobs/domain_delete_job.rb b/app/jobs/domain_delete_job.rb index 5336dc466..7d86e9885 100644 --- a/app/jobs/domain_delete_job.rb +++ b/app/jobs/domain_delete_job.rb @@ -3,6 +3,7 @@ class DomainDeleteJob < Que::Job def run(domain_id) domain = Domain.find(domain_id) + ::PaperTrail.whodunnit = "job - #{self.class.name}" WhoisRecord.where(domain_id: domain.id).destroy_all domain.destroy diff --git a/app/jobs/domain_set_delete_candidate_job.rb b/app/jobs/domain_set_delete_candidate_job.rb index cc6f3f255..f1e489694 100644 --- a/app/jobs/domain_set_delete_candidate_job.rb +++ b/app/jobs/domain_set_delete_candidate_job.rb @@ -3,6 +3,7 @@ class DomainSetDeleteCandidateJob < Que::Job def run(domain_id) domain = Domain.find(domain_id) domain.statuses << DomainStatus::DELETE_CANDIDATE + ::PaperTrail.whodunnit = "job - #{self.class.name}" domain.save(validate: false) DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) end From 0f33a0fb70da1fb2aa602a6f7e02374181db6774 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 29 Mar 2016 17:44:01 +0300 Subject: [PATCH 069/247] story#114871365 - differintiate which value we're setting in if --- lib/tasks/convert.rake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index 7b5adb9a5..35e68046c 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -50,8 +50,8 @@ namespace :convert do count = 0 ContactVersion.find_each do |c| - if if_object = (c.object && c.object["country_code"].present? && c.object["country_code"] != c.object["country_code"].upcase) || - if_changes = (c.object_changes && c.object_changes["country_code"].present? && c.object_changes["country_code"] != c.object_changes["country_code"].map{|e|e.try(:upcase)}) + if (if_object = (c.object && c.object["country_code"].present? && c.object["country_code"] != c.object["country_code"].upcase)) || + (if_changes = (c.object_changes && c.object_changes["country_code"].present? && c.object_changes["country_code"] != c.object_changes["country_code"].map{|e|e.try(:upcase)})) if if_object h = c.object @@ -63,7 +63,6 @@ namespace :convert do h = c.object_changes h["country_code"] = h["country_code"].map{|e|e.try(:upcase)} c.object_changes = h - binding.pry end c.update_columns(object: c.object, object_changes: c.object_changes) From 44e5f10c38aaeb102e25a4ae1557318c17a38f72 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 29 Mar 2016 18:05:46 +0300 Subject: [PATCH 070/247] story#115762063 - show all dnskey attributes in history --- app/views/admin/domains/partials/_version.haml | 10 ++++++++++ app/views/admin/domains/versions.haml | 1 + 2 files changed, 11 insertions(+) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 15768ea16..31619dbbc 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -7,6 +7,7 @@ - if version # normal history - children = HashWithIndifferentAccess.new(version.children) - nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at) + - dnskeys = Dnskey.all_versions_for(children[:dnskeys], version.created_at) - tech_contacts = Contact.all_versions_for(children[:tech_contacts], version.created_at) - admin_contacts = Contact.all_versions_for(children[:admin_contacts], version.created_at) - registrant = Contact.all_versions_for(children[:registrant], version.created_at) @@ -14,6 +15,7 @@ - creator = plain_username(version.terminator) - else # pending history - nameservers = domain.nameservers + - dnskeys = domain.dnskeys - tech_contacts = domain.tech_contacts - admin_contacts = domain.admin_contacts - registrant = [domain.registrant] @@ -95,6 +97,14 @@ = ns[:ipv4].presence = ns[:ipv6].presence %br + %td + - Array(dnskeys).each do |ns| + %p + = ns.flags + = ns.protocol + = ns.alg + %br + = ns.attributes.except("id", "domain_id", "updated_at", "legacy_domain_id") %td{class: changing_css_class(version,"registrar_id")} - if domain.registrar diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index 175b0be02..63d318236 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -15,6 +15,7 @@ %th{class: 'col-xs-2'}= t(:admin) %th{class: 'col-xs-2'}= t(:tech) %th{class: 'col-xs-2'}= t(:nameservers) + %th{class: 'col-xs-2'}= t(:dnskeys) %th{class: 'col-xs-2'}= t(:registrar) %tbody From da0f11d47ffd924e2e09d6496a36a36f8c5a2779 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 29 Mar 2016 18:08:31 +0300 Subject: [PATCH 071/247] story#115762063 - render link to pure history --- app/views/admin/domains/partials/_version.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 31619dbbc..c7f4862cf 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -32,6 +32,9 @@ = event %br = creator + - if version + %p.text-right + = link_to "Pure history", admin_domain_version_path(version) %td{class: changing_css_class(version,"statuses")} %p From 8c5c1dd087d2bdfc1dd8fd93d3a77f905283e27d Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 30 Mar 2016 13:51:41 +0300 Subject: [PATCH 072/247] 113430903-delete_by_status_added --- app/models/domain_cron.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 24c0aac74..390708e76 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -87,6 +87,14 @@ class DomainCron STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test? c = 0 + + Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| + WhoisRecord.where(domain_id: x.id).destroy_all + DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) + STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{x.id} (#{x.name})\n" unless Rails.env.test? + c += 1 + end + Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? From f873b14214de8f1817ef53febf516fb9f5210efd Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 30 Mar 2016 17:07:27 +0300 Subject: [PATCH 073/247] story#115762063 - children log method doesn't save ids marked for destruction --- app/models/domain.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 29a53ead3..a7815c9ce 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -725,14 +725,18 @@ class Domain < ActiveRecord::Base # rubocop: enable Metrics/CyclomaticComplexity # rubocop: enable Metrics/PerceivedComplexity + + # small optimization that we'are using to_a if it was done already + # otherwise just getting ids def children_log - log = HashWithIndifferentAccess.new - log[:admin_contacts] = admin_contact_ids - log[:tech_contacts] = tech_contact_ids - log[:nameservers] = nameserver_ids + log = HashWithIndifferentAccess.new + types = %i(admin_contacts tech_contacts nameservers dnskeys domain_statuses) + + types.each do |rel| + ids = send(rel).loaded? ? send(rel).reject(&:marked_for_destruction?).map(&:id) : send(rel).pluck(:id) + log[rel] = ids + end log[:registrant] = [registrant_id] - log[:domain_statuses]= domain_status_ids - log[:dnskeys] = dnskey_ids log end From fb330ad87a134e51e98742eb8f83e644020eef26 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 30 Mar 2016 17:37:37 +0300 Subject: [PATCH 074/247] story#115762063 - not always we have all the data in log_children table --- app/models/concerns/versions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index 779bd781a..49c4298f2 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -60,7 +60,7 @@ module Versions module ClassMethods def all_versions_for(ids, time) ver_klass = paper_trail_version_class - from_history = ver_klass.where(item_id: ids). + from_history = ver_klass.where(item_id: ids.to_a). order(:item_id). preceding(time + 1, true). select("distinct on (item_id) #{ver_klass.table_name}.*"). @@ -70,7 +70,7 @@ module Versions ver.object_changes.to_h.each { |k, v| o[k]=v[-1] } o end - not_in_history = where(id: (ids - from_history.map(&:id))) + not_in_history = where(id: (ids.to_a - from_history.map(&:id))) from_history + not_in_history end From a75d8c840716632a4eeba329e982a216bd788ae1 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 31 Mar 2016 17:51:40 +0300 Subject: [PATCH 075/247] 116209751-option_added --- app/models/depp/domain.rb | 11 +++++++++++ app/views/registrar/domains/delete.haml | 5 +++++ .../registrar/domains/form_partials/_general.haml | 5 +++++ config/locales/en.yml | 2 ++ 4 files changed, 23 insertions(+) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index 7b4630008..03ee83592 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -187,6 +187,12 @@ module Depp } end + if domain_params[:verified].present? + custom_params[:_anonymus] << { + chg: { registrant_verified: 'yes' } + } + end + if domain_params[:reserved_pw].present? custom_params[:_anonymus] << { reserved: { pw: { value: domain_params[:reserved_pw] } } } end @@ -217,6 +223,11 @@ module Depp chg = [{ registrant: { value: domain_params[:registrant] } }] end + if domain_params[:verified].present? + chg.push({ registrant_verified: 'yes'}) if chg.present? + chg = [{ registrant_verified: 'yes'}] if chg.nil? + end + add_arr = nil if add_arr.none? rem_arr = nil if rem_arr.none? diff --git a/app/views/registrar/domains/delete.haml b/app/views/registrar/domains/delete.haml index 13953a6e3..5216622fb 100644 --- a/app/views/registrar/domains/delete.haml +++ b/app/views/registrar/domains/delete.haml @@ -7,6 +7,11 @@ = t(:legal_document) .panel-body .form-group + .col-md-3.control-label + = label_tag :verified, t(:verified) + .col-md-7 + = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + .col-md-4.control-label = label_tag 'domain[legal_document]', t(:legal_document), class: 'required' %p.help-block= t(:legal_document_max_size) diff --git a/app/views/registrar/domains/form_partials/_general.haml b/app/views/registrar/domains/form_partials/_general.haml index e4c124803..51f855f4e 100644 --- a/app/views/registrar/domains/form_partials/_general.haml +++ b/app/views/registrar/domains/form_partials/_general.haml @@ -23,6 +23,11 @@ = text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden" = text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true + .form-group + .col-md-3.control-label + = label_tag :verified, t(:verified) + .col-md-7 + = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" - unless params[:domain_name] .form-group diff --git a/config/locales/en.yml b/config/locales/en.yml index 6b9a7af3c..ffa18216d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -941,3 +941,5 @@ en: edit_pw: 'Edit Pw' optional: 'Optional' test_registrar: "Test registrar" + verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?' + verified: 'Verified' From 733d48d9328804a6b599041fa6505c83267e692f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 1 Apr 2016 11:32:23 +0300 Subject: [PATCH 076/247] updated EPP doc with supported DNSSEC algorithms --- doc/epp/domain.md | 4 ++-- doc/epp/keyrelay.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/epp/domain.md b/doc/epp/domain.md index 524deee1e..178ab629b 100644 --- a/doc/epp/domain.md +++ b/doc/epp/domain.md @@ -32,7 +32,7 @@ Domain name mapping protocol short version: 1-n 1 Allowed values: 0, 256, 257 1 Allowed values: 3 - 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255 + 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 1 Public key 1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 1 Base64 encoded document. @@ -81,7 +81,7 @@ Domain name mapping protocol short version: 1-n 1 Allowed values: 0, 256, 257 1 Allowed values: 3 - 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255 + 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 1 Public key 0-1 Attribute: xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd" 0-1 Base64 encoded document. Required if registrant is changing. diff --git a/doc/epp/keyrelay.md b/doc/epp/keyrelay.md index f61765b2c..804fed6db 100644 --- a/doc/epp/keyrelay.md +++ b/doc/epp/keyrelay.md @@ -11,7 +11,7 @@ NB! Keyrelay not implemented. 1 1 Allowed values: 0, 256, 257 1 Allowed values: 3 - 1 Allowed values: 3, 5, 6, 7, 8, 252, 253, 254, 255 + 1 Allowed values: 3, 5, 6, 7, 8, 10, 13, 14 1 Public key 1 1 Domain password. Attribute: roid="String" From ee36333640b4f588ad1b3b68722614699b35ab02 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 4 Apr 2016 14:59:09 +0300 Subject: [PATCH 077/247] Story#115405945 - setting pending update should update updated_at --- app/models/domain.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/domain.rb b/app/models/domain.rb index a71a06467..3c7ad14e2 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -395,6 +395,7 @@ class Domain < ActiveRecord::Base self.registrant_verification_token = token self.registrant_verification_asked_at = asked_at set_pending_update + touch_always_version pending_json['new_registrant_id'] = new_registrant_id pending_json['new_registrant_email'] = new_registrant_email pending_json['new_registrant_name'] = new_registrant_name From accdf6b6f2dc1cbcff1361c28acc6ca7397dfb6d Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 4 Apr 2016 16:35:42 +0300 Subject: [PATCH 078/247] 113430903-start_delete_candidate_method_change --- app/models/domain_cron.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 390708e76..93f904cf2 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -74,11 +74,13 @@ class DomainCron d.each do |domain| next unless domain.delete_candidateable? real += 1 + domain.statuses << DomainStatus::DELETE_CANDIDATE STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? - DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) and marked += 1 + ::PaperTrail.whodunnit = "cron - #{__method__}" + domain.save(validate: false) and marked += 1 end ensure # the operator should see what was accomplished - STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test? end marked end @@ -96,6 +98,7 @@ class DomainCron end Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| + WhoisRecord.where(domain_id: x.id).destroy_all DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 From 3052e3dc16dc71c1a43b91207875fd30e67702d5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 09:10:00 +0300 Subject: [PATCH 079/247] story#115762063 - render in domain history publickey's only meaning numbers --- app/views/admin/domains/partials/_version.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index c7f4862cf..b7a790e7c 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -106,8 +106,7 @@ = ns.flags = ns.protocol = ns.alg - %br - = ns.attributes.except("id", "domain_id", "updated_at", "legacy_domain_id") + = ns.public_key.to_s[-20,20] %td{class: changing_css_class(version,"registrar_id")} - if domain.registrar From d5da0f88815afa8fd1ab2a79479bc73e51f6d498 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 09:15:24 +0300 Subject: [PATCH 080/247] story#115762063 - render in domain history publickey's only meaning numbers --- app/views/admin/domain_versions/show.haml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 6244e60f0..0f99d4c4c 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -5,6 +5,7 @@ - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.all_versions_for(children[:nameservers], @version.created_at) + - dnskeys = Dnskey.all_versions_for(children[:dnskeys], @version.created_at) - tech_contacts = Contact.all_versions_for(children[:tech_contacts], @version.created_at) - admin_contacts = Contact.all_versions_for(children[:admin_contacts], @version.created_at) - registrant = Contact.all_versions_for(children[:registrant], @version.created_at) @@ -72,6 +73,15 @@ = ns[:ipv6] %br + %dt= t(:dnskeys) + %dd + - dnskeys.each do |ns| + = ns[:flags] + = ns[:protocol] + = ns[:alg] + = ns[:public_key].to_s[-20,20] + %br + %dt= t(:registrar) %dd{class: changing_css_class(@version,"registrar_id")} = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do From 442b2b5a714633fff08c53182b7944e687536249 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 5 Apr 2016 14:52:27 +0300 Subject: [PATCH 081/247] 116209751-css_modification --- app/views/registrar/domains/delete.haml | 5 +++-- .../registrar/domains/form_partials/_general.haml | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/views/registrar/domains/delete.haml b/app/views/registrar/domains/delete.haml index 5216622fb..706587629 100644 --- a/app/views/registrar/domains/delete.haml +++ b/app/views/registrar/domains/delete.haml @@ -7,11 +7,12 @@ = t(:legal_document) .panel-body .form-group - .col-md-3.control-label + .col-md-4.control-label = label_tag :verified, t(:verified) - .col-md-7 + .col-md-6 = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + .form-group .col-md-4.control-label = label_tag 'domain[legal_document]', t(:legal_document), class: 'required' %p.help-block= t(:legal_document_max_size) diff --git a/app/views/registrar/domains/form_partials/_general.haml b/app/views/registrar/domains/form_partials/_general.haml index 51f855f4e..a41e6cd2b 100644 --- a/app/views/registrar/domains/form_partials/_general.haml +++ b/app/views/registrar/domains/form_partials/_general.haml @@ -23,11 +23,13 @@ = text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden" = text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true - .form-group - .col-md-3.control-label - = label_tag :verified, t(:verified) - .col-md-7 - = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + + - if params[:domain_name] + .form-group + .col-md-3.control-label + = label_tag :verified, t(:verified) + .col-md-7 + = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" - unless params[:domain_name] .form-group From 5e2e7d3ed2b48c25bee91af9a8287734c26b7657 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 15:38:54 +0300 Subject: [PATCH 082/247] story#116954569 - Parse id-card data in new apache --- app/models/registrant_user.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 413ff1202..12cae0d82 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -30,10 +30,20 @@ class RegistrantUser < User return false if issuer_organization != ACCEPTED_ISSUER idc_data.force_encoding('UTF-8') - identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first - country = idc_data.scan(/^\/C=(.{2})/).flatten.first - first_name = idc_data.scan(%r{/GN=(.+)/serialNumber}).flatten.first - last_name = idc_data.scan(%r{/SN=(.+)/GN}).flatten.first + + # handling here new and old mode + if idc_data.starts_with?("/") + identity_code = idc_data.scan(/serialNumber=(\d+)/).flatten.first + country = idc_data.scan(/^\/C=(.{2})/).flatten.first + first_name = idc_data.scan(%r{/GN=(.+)/serialNumber}).flatten.first + last_name = idc_data.scan(%r{/SN=(.+)/GN}).flatten.first + else + parse_str = "," + idc_data + identity_code = parse_str.scan(/,serialNumber=(\d+)/).flatten.first + country = parse_str.scan(/,C=(.{2})/).flatten.first + first_name = parse_str.scan(/,GN=([^,]+)/).flatten.first + last_name = parse_str.scan(/,SN=([^,]+)/).flatten.first + end u = where(registrant_ident: "#{country}-#{identity_code}").first_or_create u.username = "#{first_name} #{last_name}" From 375e6490097aaa47070fb8b1e86baf92f5cfd336 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 16:12:33 +0300 Subject: [PATCH 083/247] story#116954455 - set parameter debug for Directo monthly invoices --- app/models/directo.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/models/directo.rb b/app/models/directo.rb index 0bfdd4548..d20874630 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -60,7 +60,8 @@ class Directo < ActiveRecord::Base end - def self.send_monthly_invoices + def self.send_monthly_invoices(debug: false) + @debug = debug I18n.locale = :et month = Time.now - 1.month invoices_until = month.end_of_month @@ -141,10 +142,14 @@ class Directo < ActiveRecord::Base data = builder.to_xml.gsub("\n",'') response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false).to_s - Setting.directo_monthly_number_last = directo_next - Nokogiri::XML(response).css("Result").each do |res| - Directo.create!(response: res.as_json.to_h, invoice_number: directo_next) - Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}") + if @debug + STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n" + else + Setting.directo_monthly_number_last = directo_next + Nokogiri::XML(response).css("Result").each do |res| + Directo.create!(response: res.as_json.to_h, invoice_number: directo_next) + Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}") + end end else Rails.logger.info("[DIRECTO] Registrar #{registrar.id} has nothing to be sent to Directo") From 56f9cb325de4c0432a7011fdefe98624fc089a1a Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 16:15:59 +0300 Subject: [PATCH 084/247] story#116954455 - save Directo request --- app/models/directo.rb | 2 +- db/migrate/20160405131315_add_request_to_directo.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160405131315_add_request_to_directo.rb diff --git a/app/models/directo.rb b/app/models/directo.rb index d20874630..523a7b036 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -147,7 +147,7 @@ class Directo < ActiveRecord::Base else Setting.directo_monthly_number_last = directo_next Nokogiri::XML(response).css("Result").each do |res| - Directo.create!(response: res.as_json.to_h, invoice_number: directo_next) + Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next) Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}") end end diff --git a/db/migrate/20160405131315_add_request_to_directo.rb b/db/migrate/20160405131315_add_request_to_directo.rb new file mode 100644 index 000000000..2efb95f7d --- /dev/null +++ b/db/migrate/20160405131315_add_request_to_directo.rb @@ -0,0 +1,5 @@ +class AddRequestToDirecto < ActiveRecord::Migration + def change + add_column :directos, :request, :text + end +end From fa682e178019b5fbebf735c82215f9fd703237ad Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 5 Apr 2016 16:53:18 +0300 Subject: [PATCH 085/247] story#116954455 - directo monthly invoices use billing date, not real --- app/models/directo.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/directo.rb b/app/models/directo.rb index 523a7b036..50153ef89 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -101,8 +101,8 @@ class Directo < ActiveRecord::Base "ProductName" => ".#{pricelist.category} registreerimine: #{pricelist.years_amount} aasta", "UnitPriceWoVAT" => pricelist.price_decimal/pricelist.years_amount } - hash["StartDate"] = (activity.created_at + year.year).strftime(date_format) if year > 1 - hash["EndDate"] = (activity.created_at + year.year + 1).strftime(date_format) if year > 1 + hash["StartDate"] = (activity.created_at + (year-1).year).end_of_month.strftime(date_format) if year > 1 + hash["EndDate"] = (activity.created_at + (year-1).year + 1).end_of_month.strftime(date_format) if year > 1 if items.has_key?(hash) items[hash]["Quantity"] += 1 @@ -113,8 +113,10 @@ class Directo < ActiveRecord::Base end #adding prepaiments - registrar_activities.where(activity_type: [AccountActivity::ADD_CREDIT]).each do |activity| - hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>activity.sum} + if items.any? + total = 0 + items.each{ |key, val| total += val["Quantity"] * key["UnitPriceWoVAT"] } + hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>total} items[hash] = {"RN"=>counter.next, "RR" => counter.now, "Quantity"=> -1} end From f490d16a198225b592dd5701fe464c9d56f5b910 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 5 Apr 2016 17:15:34 +0300 Subject: [PATCH 086/247] 116207475-error_added --- app/models/epp/domain.rb | 5 ++++- config/locales/en.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index d1da30a2f..85498422e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -133,7 +133,8 @@ class Epp::Domain < Domain [:base, :ds_data_not_allowed], [:base, :key_data_not_allowed], [:period, :not_a_number], - [:period, :not_an_integer] + [:period, :not_an_integer], + [:registrant, :cannot_be_missing] ], '2308' => [ [:base, :domain_name_blocked, { value: { obj: 'name', val: name_dirty } }] @@ -166,6 +167,8 @@ class Epp::Domain < Domain else add_epp_error('2303', 'registrant', code, [:registrant, :not_found]) end + else + add_epp_error('2306', nil, nil, [:registrant, :cannot_be_missing]) end at[:name] = frame.css('name').text if new_record? diff --git a/config/locales/en.yml b/config/locales/en.yml index 6b9a7af3c..e687458cc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -77,6 +77,7 @@ en: registrant: blank: 'Registrant is missing' not_found: 'Registrant not found' + cannot_be_missing: 'Parameter value policy error: registrant cannot be missing' domain_contacts: invalid: 'Contacts are invalid' not_found: 'Contact was not found' From ebc8938b0617cc0b146c80dfcd44927b8a67e67b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 6 Apr 2016 12:07:36 +0300 Subject: [PATCH 087/247] story#116954455 - fix directo min param --- app/models/directo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/directo.rb b/app/models/directo.rb index 50153ef89..05d9da5aa 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -68,7 +68,7 @@ class Directo < ActiveRecord::Base date_format = "%Y-%m-%d" invoice_counter= Counter.new - min_directo = Setting.invoice_number_min.presence.try(:to_i) + min_directo = Setting.directo_monthly_number_min.presence.try(:to_i) max_directo = Setting.directo_monthly_number_max.presence.try(:to_i) last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i), min_directo].compact.max || 0 if max_directo && max_directo <= last_directo From 3425deb0fac5cd65c0f73b8d33af2604c3dabc76 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 6 Apr 2016 15:02:05 +0300 Subject: [PATCH 088/247] 113430903-method_merge --- app/models/domain_cron.rb | 56 ++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/app/models/domain_cron.rb b/app/models/domain_cron.rb index 93f904cf2..ba5d72f19 100644 --- a/app/models/domain_cron.rb +++ b/app/models/domain_cron.rb @@ -64,25 +64,27 @@ class DomainCron marked end - def self.start_delete_period - begin - STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test? + #doing nothing, deprecated - d = Domain.where('delete_at <= ?', Time.zone.now) - marked = 0 - real = 0 - d.each do |domain| - next unless domain.delete_candidateable? - real += 1 - domain.statuses << DomainStatus::DELETE_CANDIDATE - STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? - ::PaperTrail.whodunnit = "cron - #{__method__}" - domain.save(validate: false) and marked += 1 - end - ensure # the operator should see what was accomplished - STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test? - end - marked + def self.start_delete_period + # begin + # STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test? + # + # d = Domain.where('delete_at <= ?', Time.zone.now) + # marked = 0 + # real = 0 + # d.each do |domain| + # next unless domain.delete_candidateable? + # real += 1 + # domain.statuses << DomainStatus::DELETE_CANDIDATE + # STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test? + # ::PaperTrail.whodunnit = "cron - #{__method__}" + # domain.save(validate: false) and marked += 1 + # end + # ensure # the operator should see what was accomplished + # STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\n" unless Rails.env.test? + # end + # marked end def self.destroy_delete_candidates @@ -90,15 +92,21 @@ class DomainCron c = 0 - Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| - WhoisRecord.where(domain_id: x.id).destroy_all - DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) - STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{x.id} (#{x.name})\n" unless Rails.env.test? - c += 1 + Domain.where('delete_at <= ?', Time.zone.now).each do |x| + next unless x.delete_candidateable? + + x.statuses << DomainStatus::DELETE_CANDIDATE + + # If domain successfully saved, add it to delete schedule + if x.save(validate: false) + ::PaperTrail.whodunnit = "cron - #{__method__}" + DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) + STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{x.id} (#{x.name})\n" unless Rails.env.test? + c += 1 + end end Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| - WhoisRecord.where(domain_id: x.id).destroy_all DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now) STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? c += 1 From 00948384a61ccdc0775cddffb18b19dd6d9eec40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 7 Apr 2016 11:40:02 +0300 Subject: [PATCH 089/247] lowered the minimum legalDocument size requirement to 3kB --- app/assets/javascripts/registrar/application.coffee | 4 ++-- app/models/legal_document.rb | 2 +- config/locales/en.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/registrar/application.coffee b/app/assets/javascripts/registrar/application.coffee index 943f14a23..a1a2084fe 100644 --- a/app/assets/javascripts/registrar/application.coffee +++ b/app/assets/javascripts/registrar/application.coffee @@ -29,13 +29,13 @@ $(document).on 'page:change', -> $('.js-contact-form').trigger('restoreDefault') $('[data-legal-document]').each (i, fileInput)-> - minSize = 8 * 1024 # 8kB + minSize = 3 * 1024 # 3kB maxSize = 8 * 1024 * 1024; # 8 MB $(fileInput).closest('form').submit (e) -> if (files = fileInput.files).length fileSize = files[0].size if fileSize < minSize - alert 'Document size should be more than 8kB' + alert 'Document size should be more than 3kB' return false else if fileSize > maxSize alert 'Document size should be less than 8MB' diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index c3b0c66ea..b4bf3c96b 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -1,6 +1,6 @@ class LegalDocument < ActiveRecord::Base include EppErrors - MIN_BODY_SIZE = (1.37 * 8.kilobytes).ceil + MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil if ENV['legal_document_types'].present? TYPES = ENV['legal_document_types'].split(',').map(&:strip) diff --git a/config/locales/en.yml b/config/locales/en.yml index 0ced7eb78..2e97f6f9f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -209,7 +209,7 @@ en: legal_document: attributes: body: - length: 'Parameter value policy error: legalDocument size should be more than 8kB' + length: 'Parameter value policy error: legalDocument size should be more than 3kB' attributes: From 3063c2f5d22bf342ca19d2dcd5757f26e26641ec Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 7 Apr 2016 11:50:34 +0300 Subject: [PATCH 090/247] 116207475-if_block_changed --- app/models/epp/domain.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 85498422e..477d8c28f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -156,7 +156,8 @@ class Epp::Domain < Domain def attrs_from(frame, current_user, action = nil) at = {}.with_indifferent_access - code = frame.css('registrant').first.try(:text) + registrant_frame = frame.css('registrant').first + code = registrant_frame.try(:text) if code.present? if action == 'chg' && registrant_change_prohibited? add_epp_error('2304', nil, DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation)) @@ -168,8 +169,9 @@ class Epp::Domain < Domain add_epp_error('2303', 'registrant', code, [:registrant, :not_found]) end else - add_epp_error('2306', nil, nil, [:registrant, :cannot_be_missing]) - end + add_epp_error('2306', nil, nil, [:registrant, :cannot_be_missing]) + end if registrant_frame + at[:name] = frame.css('name').text if new_record? at[:registrar_id] = current_user.registrar.try(:id) From e4cdd23248321ae966ba9b5a6853b2d463fdb489 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 7 Apr 2016 16:05:52 +0300 Subject: [PATCH 091/247] story#115762063 - revert how children ids are saved --- app/models/domain.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index a7815c9ce..86b6d4a60 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -729,13 +729,12 @@ class Domain < ActiveRecord::Base # small optimization that we'are using to_a if it was done already # otherwise just getting ids def children_log - log = HashWithIndifferentAccess.new - types = %i(admin_contacts tech_contacts nameservers dnskeys domain_statuses) - - types.each do |rel| - ids = send(rel).loaded? ? send(rel).reject(&:marked_for_destruction?).map(&:id) : send(rel).pluck(:id) - log[rel] = ids - end + log = HashWithIndifferentAccess.new + log[:admin_contacts] = admin_contact_ids + log[:tech_contacts] = tech_contact_ids + log[:nameservers] = nameserver_ids + log[:domain_statuses]= domain_status_ids + log[:dnskeys] = dnskey_ids log[:registrant] = [registrant_id] log end From 1d5a79f406379dc4052a6d9382e83d12f7a1d967 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 7 Apr 2016 16:45:44 +0300 Subject: [PATCH 092/247] Story#117124725 - raise an error ConfirmingRegistrant Change job --- app/jobs/domain_update_confirm_job.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/jobs/domain_update_confirm_job.rb b/app/jobs/domain_update_confirm_job.rb index 098b9853e..67007d334 100644 --- a/app/jobs/domain_update_confirm_job.rb +++ b/app/jobs/domain_update_confirm_job.rb @@ -7,8 +7,13 @@ class DomainUpdateConfirmJob < Que::Job case action when RegistrantVerification::CONFIRMED domain.poll_message!(:poll_pending_update_confirmed_by_registrant) + raise_errors!(domain) + domain.apply_pending_update! + raise_errors!(domain) + domain.clean_pendings! + raise_errors!(domain) when RegistrantVerification::REJECTED domain.send_mail :pending_update_rejected_notification_for_new_registrant domain.poll_message!(:poll_pending_update_rejected_by_registrant) @@ -17,4 +22,8 @@ class DomainUpdateConfirmJob < Que::Job destroy # it's best to destroy the job in the same transaction end end + + def raise_errors!(domain) + throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any? + end end From a091c62264ba77085cfe0872b586c5e1621b072c Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 8 Apr 2016 14:58:56 +0300 Subject: [PATCH 093/247] Story#117124725 - generate emails of apply_pending_update! only when everything is ok --- app/mailers/domain_mailer.rb | 30 +++++++++++++-- app/models/domain_mail_model.rb | 21 ---------- app/models/epp/domain.rb | 10 +++-- ...d_notification_for_new_registrant.html.erb | 36 +++++++++--------- ...d_notification_for_new_registrant.text.erb | 38 ++++++++++--------- ...d_notification_for_old_registrant.html.erb | 36 +++++++++--------- ...d_notification_for_old_registrant.text.erb | 36 +++++++++--------- spec/mailers/domain_mailer_spec.rb | 4 +- 8 files changed, 108 insertions(+), 103 deletions(-) diff --git a/app/mailers/domain_mailer.rb b/app/mailers/domain_mailer.rb index 28e232a8c..fb2c0e851 100644 --- a/app/mailers/domain_mailer.rb +++ b/app/mailers/domain_mailer.rb @@ -9,12 +9,34 @@ class DomainMailer < ApplicationMailer compose_from(params) end - def registrant_updated_notification_for_new_registrant(params) - compose_from(params) + + def registrant_updated_notification_for_new_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver) + @domain = Domain.find_by(id: domain_id) + return unless @domain + return if delivery_off?(@domain, should_deliver) + + @old_registrant = Registrant.find(old_registrant_id) + @new_registrant = Registrant.find(new_registrant_id) + + return if whitelist_blocked?(@new_registrant.email) + mail(to: format(@new_registrant.email), + subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject, + name: @domain.name)} [#{@domain.name}]") end - def registrant_updated_notification_for_old_registrant(params) - compose_from(params) + + def registrant_updated_notification_for_old_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver) + domain = Domain.find_by(id: domain_id) + return unless domain + return if delivery_off?(@domain, should_deliver) + + @old_registrant = Registrant.find(old_registrant_id) + @new_registrant = Registrant.find(new_registrant_id) + + return if whitelist_blocked?(@old_registrant.email) + mail(to: format(@old_registrant.email), + subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject, + name: @domain.name)} [#{@domain.name}]") end def pending_update_rejected_notification_for_new_registrant(params) diff --git a/app/models/domain_mail_model.rb b/app/models/domain_mail_model.rb index 46309ad52..d443d8783 100644 --- a/app/models/domain_mail_model.rb +++ b/app/models/domain_mail_model.rb @@ -20,28 +20,7 @@ class DomainMailModel domain_info compose end - - def registrant_updated_notification_for_new_registrant - registrant - subject(:registrant_updated_notification_for_new_registrant_subject) - domain_info - compose - end - def registrant_updated_notification_for_old_registrant - registrant_pending - registrant_old - subject(:registrant_updated_notification_for_old_registrant_subject) - new_registrant = Registrant.find @domain.pending_json['new_registrant_id'] - @params[:registrant_name] = new_registrant.name - @params[:registrant_ident] = new_registrant.ident - @params[:registrant_priv] = new_registrant.priv? - @params[:registrant_email] = new_registrant.email - @params[:registrant_street] = new_registrant.street - @params[:registrant_city] = new_registrant.city - @params[:registrant_country] = new_registrant.country.name - compose - end def pending_update_rejected_notification_for_new_registrant registrant_pending diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 1f2dd2d54..2905bd968 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -525,19 +525,21 @@ class Epp::Domain < Domain preclean_pendings user = ApiUser.find(pending_json['current_user_id']) frame = Nokogiri::XML(pending_json['frame']) + old_registrant_id = registrant_id self.deliver_emails = true # turn on email delivery self.statuses.delete(DomainStatus::PENDING_UPDATE) ::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user - send_mail :registrant_updated_notification_for_old_registrant return unless update(frame, user, false) clean_pendings! - send_mail :registrant_updated_notification_for_new_registrant - WhoisRecord.find_by(domain_id: id).save # need to reload model - save! # for notification if everything fails + + WhoisRecord.find_by(domain_id: id).save # need to reload model + DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, should_deliver) + DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, should_deliver) + true end diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb index c7d464f43..a654b2f80 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb @@ -1,18 +1,18 @@ Tere,

-Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. +Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.

Uue registreerija andmed:
-Nimi: <%= @params[:registrant_name] %>
-<% if @params[:registrant_priv] %> -Isikukood: <%= @params[:registrant_ident] %>
+Nimi: <%= @new_registrant.name %>
+<% if @new_registrant.priv? %> + Isikukood: <%= @new_registrant.ident %>
<% else %> -Äriregistrikood: <%= @params[:registrant_ident] %>
+ Äriregistrikood: <%= @new_registrant.ident %>
<% end %> -Epost: <%= @params[:registrant_email] %>
-Tänav: <%= @params[:registrant_street] %>
-Linn: <%= @params[:registrant_city] %>
-Riik: <%= @params[:registrant_country] %> +Epost: <%= @new_registrant.email %>
+Tänav: <%= @new_registrant.street %>
+Linn: <%= @new_registrant.city %>
+Riik: <%= @new_registrant.country.name %>

Lugupidamisega
Eesti Interneti SA @@ -21,19 +21,19 @@ Eesti Interneti SA

Hi,

-Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated. +Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.

New registrant:
-Name: <%= @params[:registrant_name] %>
-<% if @params[:registrant_priv] %> -Personal code: <%= @params[:registrant_ident] %>
+Name: <%= @new_registrant.name %>
+<% if @new_registrant.priv? %> + Personal code: <%= @new_registrant.ident %>
<% else %> -Business Registry code: <%= @params[:registrant_ident] %>
+ Business Registry code: <%= @new_registrant.ident %>
<% end %> -E-mail: <%= @params[:registrant_email] %>
-Street: <%= @params[:registrant_street] %>
-City: <%= @params[:registrant_city] %>
-Country: <%= @params[:registrant_country] %> +E-mail: <%= @new_registrant.email %>
+Street: <%= @new_registrant.street %>
+City: <%= @new_registrant.city %>
+Country: <%= @new_registrant.country.name %>

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb index 115655897..64db26ec7 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb @@ -1,18 +1,19 @@ Tere, -Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. +Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. Uue registreerija andmed: -Nimi: <%= @params[:registrant_name] %> -<% if @params[:registrant_priv] %> -Isikukood: <%= @params[:registrant_ident] %> +Nimi: <%= @new_registrant.name %> + +<% if @new_registrant.priv? %> + Isikukood: <%= @new_registrant.ident %> <% else %> -Äriregistrikood: <%= @params[:registrant_ident] %> + Äriregistrikood: <%= @new_registrant.ident %> <% end %> -Epost: <%= @params[:registrant_email] %> -Tänav: <%= @params[:registrant_street] %> -Linn: <%= @params[:registrant_city] %> -Riik: <%= @params[:registrant_country] %> +Epost: <%= @new_registrant.email %> +Tänav: <%= @new_registrant.street %> +Linn: <%= @new_registrant.city %> +Riik: <%= @new_registrant.country.name %> Lugupidamisega Eesti Interneti SA @@ -21,19 +22,20 @@ Eesti Interneti SA Hi, -Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated. +Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated. New registrant: -Name: <%= @params[:registrant_name] %> -<% if @params[:registrant_priv] %> -Personal code: <%= @params[:registrant_ident] %> +Name: <%= @new_registrant.name %> + +<% if @new_registrant.priv? %> + Personal code: <%= @new_registrant.ident %> <% else %> -Business Registry code: <%= @params[:registrant_ident] %> + Business Registry code: <%= @new_registrant.ident %> <% end %> -E-mail: <%= @params[:registrant_email] %> -Street: <%= @params[:registrant_street] %> -City: <%= @params[:registrant_city] %> -Country: <%= @params[:registrant_country] %> +E-mail: <%= @new_registrant.email %> +Street: <%= @new_registrant.street %> +City: <%= @new_registrant.city %> +Country: <%= @new_registrant.country.name %> Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb index b41e1f1eb..180988f08 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb @@ -1,18 +1,18 @@ Tere,

-Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. +Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.

Uue registreerija andmed:
-Nimi: <%= @params[:new_registrant_name] %>
-<% if @params[:registrant_priv] %> -Isikukood: <%= @params[:registrant_ident] %>
+Nimi: <%= @new_registrant.name %>
+<% if @new_registrant.priv? %> +Isikukood: <%= @new_registrant.ident %>
<% else %> -Äriregistrikood: <%= @params[:registrant_ident] %>
+Äriregistrikood: <%= @new_registrant.ident %>
<% end %> -Epost: <%= @params[:registrant_email] %>
-Tänav: <%= @params[:registrant_street] %>
-Linn: <%= @params[:registrant_city] %>
-Riik: <%= @params[:registrant_country] %> +Epost: <%= @new_registrant.email %>
+Tänav: <%= @new_registrant.street %>
+Linn: <%= @new_registrant.city %>
+Riik: <%= @new_registrant.country.name %>

Lugupidamisega
Eesti Interneti SA @@ -21,19 +21,19 @@ Eesti Interneti SA

Hi,

-Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated. +Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.

New registrant:
-Name: <%= @params[:new_registrant_name] %>
-<% if @params[:registrant_priv] %> -Personal code: <%= @params[:registrant_ident] %>
+Name: <%= @new_registrant.name %>
+<% if @new_registrant.priv? %> +Personal code: <%= @new_registrant.ident %>
<% else %> -Business Registry code: <%= @params[:registrant_ident] %>
+Business Registry code: <%= @new_registrant.ident %>
<% end %> -E-mail: <%= @params[:registrant_email] %>
-Street: <%= @params[:registrant_street] %>
-City: <%= @params[:registrant_city] %>
-Country: <%= @params[:registrant_country] %> +E-mail: <%= @new_registrant.email %>
+Street: <%= @new_registrant.street %>
+City: <%= @new_registrant.city %>
+Country: <%= @new_registrant.country.name %>

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb index c2efa5af9..1d45fb5e0 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb @@ -1,19 +1,19 @@ Tere, -Domeeni <%= @params[:name] %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. +Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. Uue registreerija andmed: -Nimi: <%= @params[:new_registrant_name] %> +Nimi: <%= @new_registrant.name %> -<% if @params[:registrant_priv] %> -Isikukood: <%= @params[:registrant_ident] %> +<% if @new_registrant.priv? %> +Isikukood: <%= @new_registrant.ident %> <% else %> -Äriregistrikood: <%= @params[:registrant_ident] %> +Äriregistrikood: <%= @new_registrant.ident %> <% end %> -Epost: <%= @params[:registrant_email] %> -Tänav: <%= @params[:registrant_street] %> -Linn: <%= @params[:registrant_city] %> -Riik: <%= @params[:registrant_country] %> +Epost: <%= @new_registrant.email %> +Tänav: <%= @new_registrant.street %> +Linn: <%= @new_registrant.city %> +Riik: <%= @new_registrant.country.name %> Lugupidamisega Eesti Interneti SA @@ -22,20 +22,20 @@ Eesti Interneti SA Hi, -Process for changing registrant of the domain <%= @params[:name] %> has been approved and the data in the registry is updated. +Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated. New registrant: -Name: <%= @params[:new_registrant_name] %> +Name: <%= @new_registrant.name %> -<% if @params[:registrant_priv] %> -Personal code: <%= @params[:registrant_ident] %> +<% if @new_registrant.priv? %> +Personal code: <%= @new_registrant.ident %> <% else %> -Business Registry code: <%= @params[:registrant_ident] %> +Business Registry code: <%= @new_registrant.ident %> <% end %> -E-mail: <%= @params[:registrant_email] %> -Street: <%= @params[:registrant_street] %> -City: <%= @params[:registrant_city] %> -Country: <%= @params[:registrant_country] %> +E-mail: <%= @new_registrant.email %> +Street: <%= @new_registrant.street %> +City: <%= @new_registrant.city %> +Country: <%= @new_registrant.country.name %> Best Regards, Estonian Internet Foundation diff --git a/spec/mailers/domain_mailer_spec.rb b/spec/mailers/domain_mailer_spec.rb index 3f645f7e0..9963fdd38 100644 --- a/spec/mailers/domain_mailer_spec.rb +++ b/spec/mailers/domain_mailer_spec.rb @@ -153,7 +153,7 @@ describe DomainMailer do @registrant = Fabricate(:registrant, email: 'test@example.com') @domain = Fabricate(:domain, registrant: @registrant) @domain.deliver_emails = true - @mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, deliver_emails) + @mail = DomainMailer.registrant_updated_notification_for_new_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails) end it 'should render email subject' do @@ -178,7 +178,7 @@ describe DomainMailer do @registrant = Fabricate(:registrant, email: 'test@example.com') @domain = Fabricate(:domain, registrant: @registrant) @domain.deliver_emails = true - @mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, deliver_emails) + @mail = DomainMailer.registrant_updated_notification_for_old_registrant(@domain.id, @registrant.id, @registrant.id, deliver_emails) end it 'should render email subject' do From 912b820f82ab1d6e855cbd32f6a7c62673165393 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 8 Apr 2016 15:12:56 +0300 Subject: [PATCH 094/247] Story#117124725 - generate emails of apply_pending_update! only when everything is ok --- app/models/epp/domain.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 2905bd968..738fd1077 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -537,8 +537,8 @@ class Epp::Domain < Domain save! # for notification if everything fails WhoisRecord.find_by(domain_id: id).save # need to reload model - DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, should_deliver) - DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, should_deliver) + DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, deliver_emails) + DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, deliver_emails) true end From af81adee57b98a36f63816c77c7f1514e2fed84b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 8 Apr 2016 15:29:37 +0300 Subject: [PATCH 095/247] Story#117124725 - generate emails of apply_pending_update! only when everything is ok --- app/models/epp/domain.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 738fd1077..2092f4480 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -537,8 +537,8 @@ class Epp::Domain < Domain save! # for notification if everything fails WhoisRecord.find_by(domain_id: id).save # need to reload model - DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, deliver_emails) - DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, deliver_emails) + DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, true).deliver + DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, true).deliver true end From 28bed16539f03724792f238cf5e8cd3c96c29fa8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 8 Apr 2016 15:34:43 +0300 Subject: [PATCH 096/247] Story#117124725 - old mailer domain variable wasn't global --- app/mailers/domain_mailer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/domain_mailer.rb b/app/mailers/domain_mailer.rb index fb2c0e851..afdfe89fc 100644 --- a/app/mailers/domain_mailer.rb +++ b/app/mailers/domain_mailer.rb @@ -26,8 +26,8 @@ class DomainMailer < ApplicationMailer def registrant_updated_notification_for_old_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver) - domain = Domain.find_by(id: domain_id) - return unless domain + @domain = Domain.find_by(id: domain_id) + return unless @domain return if delivery_off?(@domain, should_deliver) @old_registrant = Registrant.find(old_registrant_id) From 55af3c8326e8a0eec0ead67313303f6f27cea7df Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 8 Apr 2016 15:54:46 +0300 Subject: [PATCH 097/247] 116209751-params_change --- app/models/depp/domain.rb | 7 +------ app/views/registrar/domains/form_partials/_general.haml | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index 03ee83592..05fd2fef9 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -189,7 +189,7 @@ module Depp if domain_params[:verified].present? custom_params[:_anonymus] << { - chg: { registrant_verified: 'yes' } + registrant_verified: { value: 'yes' } } end @@ -223,11 +223,6 @@ module Depp chg = [{ registrant: { value: domain_params[:registrant] } }] end - if domain_params[:verified].present? - chg.push({ registrant_verified: 'yes'}) if chg.present? - chg = [{ registrant_verified: 'yes'}] if chg.nil? - end - add_arr = nil if add_arr.none? rem_arr = nil if rem_arr.none? diff --git a/app/views/registrar/domains/form_partials/_general.haml b/app/views/registrar/domains/form_partials/_general.haml index a41e6cd2b..91ae7462f 100644 --- a/app/views/registrar/domains/form_partials/_general.haml +++ b/app/views/registrar/domains/form_partials/_general.haml @@ -29,7 +29,7 @@ .col-md-3.control-label = label_tag :verified, t(:verified) .col-md-7 - = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + = check_box_tag 'domain[verified]', '1', @domain_params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" - unless params[:domain_name] .form-group From deb3b9a1995082b70f3b375368b9c72384f93e58 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 8 Apr 2016 17:03:40 +0300 Subject: [PATCH 098/247] 117131083-force_delete_at_calculation_changed --- 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 05804d02f..dbdbe2d42 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = Time.zone.now + Setting.redemption_grace_period.days unless force_delete_at + self.force_delete_at = (Time.zone.now + 31.days).beginning_of_day unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( From ba1b4dbf25f735d610509a269f2d602d907d4816 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 11 Apr 2016 15:56:26 +0300 Subject: [PATCH 099/247] 117131083-force_delete_at_calculation --- 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 dbdbe2d42..b4cadb106 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = (Time.zone.now + 31.days).beginning_of_day unless force_delete_at + self.force_delete_at = (Time.zone.now + Setting.redemption_grace_period.days + 1.day).beginning_of_day unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( From 178818288d1ce7f43b6592102971e82d632c34eb Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 11 Apr 2016 16:02:42 +0300 Subject: [PATCH 100/247] 117131083-force_delete_at_calculation --- 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 b4cadb106..125fa5c75 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = (Time.zone.now + Setting.redemption_grace_period.days + 1.day).beginning_of_day unless force_delete_at + self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( From 0089ed476d7f8a3311b52f26a17fe864ead80638 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 11 Apr 2016 16:15:08 +0300 Subject: [PATCH 101/247] 116043697-save_added --- app/jobs/domain_delete_confirm_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/jobs/domain_delete_confirm_job.rb b/app/jobs/domain_delete_confirm_job.rb index cce230234..0bd129d42 100644 --- a/app/jobs/domain_delete_confirm_job.rb +++ b/app/jobs/domain_delete_confirm_job.rb @@ -13,6 +13,7 @@ class DomainDeleteConfirmJob < Que::Job domain.poll_message!(:poll_pending_delete_rejected_by_registrant) domain.cancel_pending_delete end + domain.save(validate: false) destroy # it's best to destroy the job in the same transaction end end From 00391d358200114357d4d53e1cd10bea0bff5f2a Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 11 Apr 2016 18:46:49 +0300 Subject: [PATCH 102/247] 115595167-colum_for_api_response --- app/controllers/application_controller.rb | 4 ++++ db/migrate/20160411140719_add_matching_column.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 db/migrate/20160411140719_add_matching_column.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ac26e61a3..e3a611656 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -55,6 +55,10 @@ class ApplicationController < ActionController::Base end end + def info_for_paper_trail + { svTRID: request.svTRID } + end + def user_for_paper_trail user_log_str(current_user) end diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb new file mode 100644 index 000000000..9432c0ed2 --- /dev/null +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -0,0 +1,12 @@ +class AddMatchingColumn < ActiveRecord::Migration + + def change + tables = [:log_domains, :log_contacts] + + tables.each do |table| + add_column table, :svTRID, :text + end + end + + +end From 6545ac2ae639c4a678864d3e4def227afbff10d9 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 12 Apr 2016 09:59:44 +0300 Subject: [PATCH 103/247] Story#115762063 - preload name --- app/views/admin/domain_versions/show.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 0f99d4c4c..3e1fd14b9 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,7 +1,8 @@ -= render 'shared/title', name: @version.reify.name - domain = Domain.new(@version.object.to_h) - @version.object_changes.to_h.each{|k,v| domain[k]=v.last} += render 'shared/title', name: @version.reify.name + - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.all_versions_for(children[:nameservers], @version.created_at) From 0696700e5d8fc86cf8a22dd3c17453476a300598 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 12 Apr 2016 22:32:32 +0300 Subject: [PATCH 104/247] 116209751-modification_for_update --- app/models/depp/domain.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index 05fd2fef9..c4889b062 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -187,12 +187,6 @@ module Depp } end - if domain_params[:verified].present? - custom_params[:_anonymus] << { - registrant_verified: { value: 'yes' } - } - end - if domain_params[:reserved_pw].present? custom_params[:_anonymus] << { reserved: { pw: { value: domain_params[:reserved_pw] } } } end @@ -223,6 +217,11 @@ module Depp chg = [{ registrant: { value: domain_params[:registrant] } }] end + if domain_params[:verified].present? + chg.push({ registrant_verified: 'yes'}) if chg.present? + chg = [{ registrant_verified: 'yes'}] if chg.nil? + end + add_arr = nil if add_arr.none? rem_arr = nil if rem_arr.none? From acd2c148561a8959eeb742bf0be227fb21e0213e Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 13 Apr 2016 01:11:13 +0300 Subject: [PATCH 105/247] 117131083-deleted_at_force_delete_at --- app/models/domain.rb | 6 +++--- app/models/epp/domain.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 125fa5c75..d5c275f7f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day unless force_delete_at + self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( @@ -604,7 +604,7 @@ class Domain < ActiveRecord::Base def set_graceful_expired self.outzone_at = valid_to + Setting.expire_warning_period.days - self.delete_at = outzone_at + Setting.redemption_grace_period.days + self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc self.statuses |= [DomainStatus::EXPIRED] end @@ -612,7 +612,7 @@ class Domain < ActiveRecord::Base # TODO: currently valid_to attribute update logic is open # self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit) self.outzone_at = Time.zone.now + Setting.expire_warning_period.days - self.delete_at = Time.zone.now + Setting.redemption_grace_period.days + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc statuses << DomainStatus::EXPIRED end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 1f2dd2d54..7bf01c28a 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -586,7 +586,7 @@ class Epp::Domain < Domain msg: I18n.t(:object_status_prohibits_operation) } unless pending_deletable? - self.delete_at = Time.zone.now + Setting.redemption_grace_period.days + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc set_pending_delete set_server_hold if server_holdable? save(validate: false) From 8b25a2d30e3189e096172e27926210033892ff3b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 13 Apr 2016 09:53:15 +0300 Subject: [PATCH 106/247] Story#115762063 - add double scroll --- app/assets/javascripts/admin-manifest.coffee | 1 + .../javascripts/admin/application.coffee | 32 +++++ app/views/admin/domains/versions.haml | 2 +- .../assets/javascripts/jquery.doubleScroll.js | 126 ++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 vendor/assets/javascripts/jquery.doubleScroll.js diff --git a/app/assets/javascripts/admin-manifest.coffee b/app/assets/javascripts/admin-manifest.coffee index 759e78c5a..51bc5f419 100644 --- a/app/assets/javascripts/admin-manifest.coffee +++ b/app/assets/javascripts/admin-manifest.coffee @@ -9,5 +9,6 @@ #= require shared/jquery.validate.bootstrap #= require jquery-ui/datepicker #= require select2 +#= require jquery.doubleScroll #= require shared/general #= require admin/application diff --git a/app/assets/javascripts/admin/application.coffee b/app/assets/javascripts/admin/application.coffee index 256d2e0fa..bdc1a74bb 100644 --- a/app/assets/javascripts/admin/application.coffee +++ b/app/assets/javascripts/admin/application.coffee @@ -16,3 +16,35 @@ $(document).on 'page:change', -> $(this).validate() $('[data-toggle="popover"]').popover() + + + + + # doublescroll + $('[data-doublescroll]').doubleScroll({ + onlyIfScroll: false, + scrollCss: + 'overflow-x': 'auto' + 'overflow-y': 'hidden' + contentCss: + 'overflow-x': 'auto' + 'overflow-y': 'hidden' + resetOnWindowResize: true + }) + + positionSlider = -> + for scroll in document.querySelectorAll('[data-doublescroll]') + wrapper = scroll.previousSibling + if $(scroll).offset().top < $(window).scrollTop() + wrapper.style.position = 'fixed' + wrapper.style.top = '-5px' + else + wrapper.style.position = 'relative' + wrapper.style.top = '0' + return + + positionSlider() + $(window).scroll(positionSlider).resize positionSlider + #due .report-table width: auto top scrollbar appears after resize so we do fake resize action + $(window).resize() + diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index 63d318236..b803808aa 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -4,7 +4,7 @@ .row .col-md-12 - .table-responsive + .table-responsive{data: {doublescroll: true}} %table.table.table-bordered.table-condensed %thead %tr diff --git a/vendor/assets/javascripts/jquery.doubleScroll.js b/vendor/assets/javascripts/jquery.doubleScroll.js new file mode 100644 index 000000000..45ff0642f --- /dev/null +++ b/vendor/assets/javascripts/jquery.doubleScroll.js @@ -0,0 +1,126 @@ +/* + * @name DoubleScroll + * @desc displays scroll bar on top and on the bottom of the div + * @requires jQuery + * + * @author Pawel Suwala - http://suwala.eu/ + * @author Antoine Vianey - http://www.astek.fr/ + * @version 0.5 (11-11-2015) + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Usage: + * https://github.com/avianey/jqDoubleScroll + */ +(function( $ ) { + + jQuery.fn.doubleScroll = function(userOptions) { + + // Default options + var options = { + contentElement: undefined, // Widest element, if not specified first child element will be used + scrollCss: { + 'overflow-x': 'auto', + 'overflow-y': 'hidden' + }, + contentCss: { + 'overflow-x': 'auto', + 'overflow-y': 'hidden' + }, + onlyIfScroll: true, // top scrollbar is not shown if the bottom one is not present + resetOnWindowResize: false, // recompute the top ScrollBar requirements when the window is resized + timeToWaitForResize: 30 // wait for the last update event (usefull when browser fire resize event constantly during ressing) + }; + + $.extend(true, options, userOptions); + + // do not modify + // internal stuff + $.extend(options, { + topScrollBarMarkup: '
', + topScrollBarWrapperSelector: '.doubleScroll-scroll-wrapper', + topScrollBarInnerSelector: '.doubleScroll-scroll' + }); + + var _showScrollBar = function($self, options) { + + if (options.onlyIfScroll && $self.get(0).scrollWidth <= $self.width()) { + // content doesn't scroll + // remove any existing occurrence... + $self.prev(options.topScrollBarWrapperSelector).remove(); + return; + } + + // add div that will act as an upper scroll only if not already added to the DOM + var $topScrollBar = $self.prev(options.topScrollBarWrapperSelector); + + if ($topScrollBar.length == 0) { + + // creating the scrollbar + // added before in the DOM + $topScrollBar = $(options.topScrollBarMarkup); + $self.before($topScrollBar); + + // apply the css + $topScrollBar.css(options.scrollCss); + $self.css(options.contentCss); + + // bind upper scroll to bottom scroll + $topScrollBar.bind('scroll.doubleScroll', function() { + $self.scrollLeft($topScrollBar.scrollLeft()); + }); + + // bind bottom scroll to upper scroll + var selfScrollHandler = function() { + $topScrollBar.scrollLeft($self.scrollLeft()); + }; + $self.bind('scroll.doubleScroll', selfScrollHandler); + } + + // find the content element (should be the widest one) + var $contentElement; + + if (options.contentElement !== undefined && $self.find(options.contentElement).length !== 0) { + $contentElement = $self.find(options.contentElement); + } else { + $contentElement = $self.find('>:first-child'); + } + + // set the width of the wrappers + $(options.topScrollBarInnerSelector, $topScrollBar).width($contentElement.outerWidth()); + $topScrollBar.width($self.width()); + $topScrollBar.scrollLeft($self.scrollLeft()); + + } + + return this.each(function() { + + var $self = $(this); + + _showScrollBar($self, options); + + // bind the resize handler + // do it once + if (options.resetOnWindowResize) { + + var id; + var handler = function(e) { + _showScrollBar($self, options); + }; + + $(window).bind('resize.doubleScroll', function() { + // adding/removing/replacing the scrollbar might resize the window + // so the resizing flag will avoid the infinite loop here... + clearTimeout(id); + id = setTimeout(handler, options.timeToWaitForResize); + }); + + } + + }); + + } + +}( jQuery )); From ce124beb8f7e4985aa93eb31bea4ec2ec7f64e2b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 13 Apr 2016 10:50:41 +0300 Subject: [PATCH 107/247] Story#117124725 - show errors if something happens --- app/jobs/domain_delete_confirm_job.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/jobs/domain_delete_confirm_job.rb b/app/jobs/domain_delete_confirm_job.rb index cce230234..e147e3aa8 100644 --- a/app/jobs/domain_delete_confirm_job.rb +++ b/app/jobs/domain_delete_confirm_job.rb @@ -3,17 +3,30 @@ class DomainDeleteConfirmJob < Que::Job # it's recommended to keep transaction against job table as short as possible. ActiveRecord::Base.transaction do domain = Epp::Domain.find(domain_id) + case action when RegistrantVerification::CONFIRMED domain.poll_message!(:poll_pending_delete_confirmed_by_registrant) domain.apply_pending_delete! + raise_errors!(domain) + when RegistrantVerification::REJECTED - DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) domain.poll_message!(:poll_pending_delete_rejected_by_registrant) + domain.cancel_pending_delete + domain.save(validate: false) + raise_errors!(domain) + + DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver end + destroy # it's best to destroy the job in the same transaction end end + + + def raise_errors!(domain) + throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any? + end end From cef53f16d887e07b71cb53733db149e102fcad50 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 13 Apr 2016 15:14:47 +0300 Subject: [PATCH 108/247] 116209751-value_change --- app/models/depp/domain.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index c4889b062..afaff73fe 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -217,9 +217,9 @@ module Depp chg = [{ registrant: { value: domain_params[:registrant] } }] end - if domain_params[:verified].present? - chg.push({ registrant_verified: 'yes'}) if chg.present? - chg = [{ registrant_verified: 'yes'}] if chg.nil? + if domain_params[:registrant] != old_domain_params[:registrant] + chg = [{ registrant: { value: domain_params[:registrant] } }] if !domain_params[:verified].present? + chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified] end add_arr = nil if add_arr.none? From 55c6bac1d84727b59ff451d09e39ee2399d618ef Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 13 Apr 2016 19:12:58 +0300 Subject: [PATCH 109/247] 108869472-archive_modifications --- app/views/admin/contact_versions/index.haml | 2 + app/views/admin/contact_versions/show.haml | 39 +++++++++++--------- app/views/admin/domain_versions/archive.haml | 14 ++++--- app/views/admin/domain_versions/show.haml | 11 ++++-- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 68e74c547..f89cbec69 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -79,6 +79,8 @@ .col-md-6 = paginate @versions .col-md-6.text-right + .pagination + = t(:result_count, count: @versions.total_count) :coffee diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 555c301dc..f5d7ec63b 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -1,5 +1,7 @@ = render 'shared/title', name: @version.reify.name +- contact = @version.reify + .row .col-md-8 .panel.panel-default{:style => "min-height:420px;"} @@ -11,55 +13,56 @@ .panel-body %dl.dl-horizontal %dt= t(:id) - %dd= @version.reify.code + %dd= contact.code %dt= t(:ident) - %dd= ident_for(@version.reify) + %dd= ident_for(contact) %dt= t(:email) - %dd= @version.reify.email + %dd= contact.email - %dt= t(:phone) - %dd= @version.reify.phone + - if contact.phone + %dt= t(:phone) + %dd= contact.phone - - if @version.reify.fax + - if contact.fax %dt= t(:fax) - %dd= @version.reify.fax + %dd= contact.fax %br %dt= t(:created) %dd - = l(@version.reify.created_at, format: :short) + = l(contact.created_at, format: :short) %dt= t(:updated) %dd - = l(@version.reify.updated_at, format: :short) + = l(contact.updated_at, format: :short) %dt= t(:registrar) %dd - - if @version.reify.registrar.present? - = link_to(@version.reify.registrar, admin_registrar_path(@version.reify.registrar)) + - if contact.registrar.present? + = link_to(contact.registrar, admin_registrar_path(contact.registrar)) %dl.dl-horizontal - - if @version.reify.org_name.present? + - if contact.org_name.present? %dt= t(:org_name) - %dd= @version.reify.org_name + %dd= contact.org_name %dt= t(:street) - %dd= @version.reify.street.to_s.gsub("\n", '
').html_safe + %dd= contact.street.to_s.gsub("\n", '
').html_safe %dt= t(:city) - %dd= @version.reify.city + %dd= contact.city %dt= t(:zip) - %dd= @version.reify.zip + %dd= contact.zip %dt= t(:state) - %dd= @version.reify.state + %dd= contact.state %dt= t(:country) - %dd= @version.reify.country + %dd= contact.country %span{:style => "padding-right:10px; float: right;"} diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index f50f18d06..c607e559a 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -55,15 +55,15 @@ = t(:action) %tbody - @versions.each do |version| - - if version.reify + - if domain = version.reify %tr - %td= link_to(version.reify.name, admin_domain_version_path(version.id)) + %td= link_to(domain.name, admin_domain_version_path(version.id)) %td - - if version.reify.registrant - = link_to(version.reify.registrant, admin_registrant_path(version.reify.registrant)) + - if domain.registrant + = domain.registrant %td - - if version.reify.registrar - = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + - if domain.registrar + = link_to(domain.registrar, admin_registrar_path(domain.registrar)) %td= l(version.created_at, format: :short) %td= version.event @@ -72,6 +72,8 @@ .col-md-6 = paginate @versions .col-md-6.text-right + .pagination + = t(:result_count, count: @versions.total_count) :coffee diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index e6076a3db..69063b6fc 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -8,6 +8,7 @@ - registrant = Contact.where(id: children[:registrant]) - event = @version.event - creator = plain_username(@version.terminator) + - domain = @version.reify .row @@ -21,11 +22,13 @@ .panel-body %dl.dl-horizontal %dt= t(:name) - %dd= link_to(@version.reify.name, admin_domain_path(@version.item_id)) + %dd= link_to(domain.name, admin_domain_path(@version.item_id)) + %dt= t(:registered_at) + %dd= l(domain.registered_at, format: :short) %dt= t(:statuses) %dd - - if @version.reify.statuses.present? - - @version.reify.statuses.each do |s| + - if domain.statuses.present? + - domain.statuses.each do |s| = s %dt= t(:registrant) %dd @@ -59,7 +62,7 @@ = ns[:ipv6] %br %dt= t(:registrar) - %dd= @version.reify.registrar.name + %dd= domain.registrar.name %span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"} - if @version.previous = link_to(t(:previous), From 5373c76c4087b073685eb54226024ce1547ea5c0 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 14 Apr 2016 14:32:32 +0300 Subject: [PATCH 110/247] Story#116962601 - faster epp logs --- app/controllers/admin/epp_logs_controller.rb | 6 +++++- app/controllers/admin/repp_logs_controller.rb | 6 +++++- db/migrate/20160414110443_add_time_indexing_to_epp_log.rb | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160414110443_add_time_indexing_to_epp_log.rb diff --git a/app/controllers/admin/epp_logs_controller.rb b/app/controllers/admin/epp_logs_controller.rb index b14a99766..e9d8542ed 100644 --- a/app/controllers/admin/epp_logs_controller.rb +++ b/app/controllers/admin/epp_logs_controller.rb @@ -5,7 +5,11 @@ class Admin::EppLogsController < AdminController def index @q = ApiLog::EppLog.search(params[:q]) @q.sorts = 'id desc' if @q.sorts.empty? - @epp_logs = @q.result.page(params[:page]) + + @epp_logs = @q.result + @epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq] + @epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq] + @epp_logs = @epp_logs.page(params[:page]) end def show diff --git a/app/controllers/admin/repp_logs_controller.rb b/app/controllers/admin/repp_logs_controller.rb index 8e904007a..2b28c7227 100644 --- a/app/controllers/admin/repp_logs_controller.rb +++ b/app/controllers/admin/repp_logs_controller.rb @@ -5,7 +5,11 @@ class Admin::ReppLogsController < AdminController def index @q = ApiLog::ReppLog.search(params[:q]) @q.sorts = 'id desc' if @q.sorts.empty? - @repp_logs = @q.result.page(params[:page]) + + @repp_logs = @q.result + @repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq] + @repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq] + @repp_logs = @repp_logs.page(params[:page]) end def show diff --git a/db/migrate/20160414110443_add_time_indexing_to_epp_log.rb b/db/migrate/20160414110443_add_time_indexing_to_epp_log.rb new file mode 100644 index 000000000..30e4d155e --- /dev/null +++ b/db/migrate/20160414110443_add_time_indexing_to_epp_log.rb @@ -0,0 +1,6 @@ +class AddTimeIndexingToEppLog < ActiveRecord::Migration + def change + ApiLog::EppLog.connection.execute( "CREATE INDEX CONCURRENTLY epp_logs_created_at ON epp_logs USING btree (extract(epoch from created_at));") + ApiLog::ReppLog.connection.execute("CREATE INDEX CONCURRENTLY repp_logs_created_at ON repp_logs USING btree (extract(epoch from created_at));") + end +end From 57be19a41a01f330ca88e70e4c2f3bd9d69bdbf5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 14 Apr 2016 14:50:48 +0300 Subject: [PATCH 111/247] Story#116962601 - faster epp logs (check for presence) --- app/controllers/admin/epp_logs_controller.rb | 4 ++-- app/controllers/admin/repp_logs_controller.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/epp_logs_controller.rb b/app/controllers/admin/epp_logs_controller.rb index e9d8542ed..46740a8d9 100644 --- a/app/controllers/admin/epp_logs_controller.rb +++ b/app/controllers/admin/epp_logs_controller.rb @@ -7,8 +7,8 @@ class Admin::EppLogsController < AdminController @q.sorts = 'id desc' if @q.sorts.empty? @epp_logs = @q.result - @epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq] - @epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq] + @epp_logs = @epp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present? + @epp_logs = @epp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present? @epp_logs = @epp_logs.page(params[:page]) end diff --git a/app/controllers/admin/repp_logs_controller.rb b/app/controllers/admin/repp_logs_controller.rb index 2b28c7227..ff306b0fc 100644 --- a/app/controllers/admin/repp_logs_controller.rb +++ b/app/controllers/admin/repp_logs_controller.rb @@ -7,8 +7,8 @@ class Admin::ReppLogsController < AdminController @q.sorts = 'id desc' if @q.sorts.empty? @repp_logs = @q.result - @repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq] - @repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq] + @repp_logs = @repp_logs.where("extract(epoch from created_at) >= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_gteq])) if params[:q][:created_at_gteq].present? + @repp_logs = @repp_logs.where("extract(epoch from created_at) <= extract(epoch from ?::timestamp)", Time.parse(params[:q][:created_at_lteq])) if params[:q][:created_at_lteq].present? @repp_logs = @repp_logs.page(params[:page]) end From 014c466c47cc2be05d5ded4b94af05702b6b786a Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 14 Apr 2016 17:16:24 +0300 Subject: [PATCH 112/247] 108869472-modification_for_archive --- .../admin/domain_versions_controller.rb | 4 ++-- app/views/admin/contact_versions/index.haml | 19 +++++++++++-------- app/views/admin/contact_versions/show.haml | 5 +++-- app/views/admin/domain_versions/archive.haml | 7 +++++-- app/views/admin/domain_versions/show.haml | 6 +++--- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 0d85e047f..463bd8739 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -9,12 +9,12 @@ class Admin::DomainVersionsController < AdminController search_params = params[:q].deep_dup if search_params[:registrant] - registrant = Contact.find_by(name: search_params[:registrant]) + registrant = Contact.find_by(name: search_params[:registrant].strip) search_params.delete(:registrant) end if search_params[:registrar] - registrar = Registrar.find_by(name: search_params[:registrar]) + registrar = Registrar.find_by(name: search_params[:registrar].strip) search_params.delete(:registrar) end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index f89cbec69..e39c20b1f 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -25,7 +25,7 @@ .col-md-3 .form-group = label_tag :action - = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } + = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy'], ['Create', 'create']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } .col-md-3 .form-group = label_tag t(:results_per_page) @@ -62,15 +62,18 @@ = t(:action) %tbody - @versions.each do |version| - - if version.reify + - if version + - contact = Contact.new(version.object.to_h) + - version.object_changes.to_h.each{|k,v| contact[k]=v.last} + %tr - %td= link_to(version.reify.name, admin_contact_version_path(version.id)) - %td= version.reify.code - %td= ident_for(version.reify) - %td= version.reify.phone + %td= link_to(contact.name, admin_contact_version_path(version.id)) + %td= contact.code + %td= ident_for(contact) + %td= contact.phone %td - - if version.reify.registrar - = link_to(version.reify.registrar, admin_registrar_path(version.reify.registrar)) + - if contact.registrar + = link_to(contact.registrar, admin_registrar_path(contact.registrar)) %td= l(version.created_at, format: :short) %td= version.event diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index f5d7ec63b..3d4785159 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -1,6 +1,7 @@ -= render 'shared/title', name: @version.reify.name +- contact = Contact.new(@version.object.to_h) +- @version.object_changes.to_h.each{|k,v| contact[k]=v.last} -- contact = @version.reify += render 'shared/title', name: contact.name .row .col-md-8 diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index c607e559a..31fb9bc9d 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -19,7 +19,7 @@ .col-md-3 .form-group = label_tag :action - = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } + = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy'], ['Create', 'create']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } .row .col-md-3 .col-md-3 @@ -55,7 +55,10 @@ = t(:action) %tbody - @versions.each do |version| - - if domain = version.reify + - if version + - domain = Domain.new(version.object.to_h) + - version.object_changes.to_h.each{|k,v| domain[k]=v.last} + %tr %td= link_to(domain.name, admin_domain_version_path(version.id)) %td diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 69063b6fc..9143abeed 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,5 +1,3 @@ -= render 'shared/title', name: @version.reify.name - - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.where(id: children[:nameservers]) @@ -8,8 +6,10 @@ - registrant = Contact.where(id: children[:registrant]) - event = @version.event - creator = plain_username(@version.terminator) - - domain = @version.reify + - domain = Domain.new(@version.object.to_h) + - @version.object_changes.to_h.each{|k,v| domain[k]=v.last} += render 'shared/title', name: domain.name .row .col-md-8 From f3fe706eabe538e054ee6e696d9ef2c7b9fb9b99 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 14 Apr 2016 17:19:17 +0300 Subject: [PATCH 113/247] 117131083-utc_removed --- app/models/domain.rb | 6 +++--- app/models/epp/domain.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index d5c275f7f..a2ecc5451 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc unless force_delete_at + self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( @@ -604,7 +604,7 @@ class Domain < ActiveRecord::Base def set_graceful_expired self.outzone_at = valid_to + Setting.expire_warning_period.days - self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc + self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day self.statuses |= [DomainStatus::EXPIRED] end @@ -612,7 +612,7 @@ class Domain < ActiveRecord::Base # TODO: currently valid_to attribute update logic is open # self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit) self.outzone_at = Time.zone.now + Setting.expire_warning_period.days - self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day statuses << DomainStatus::EXPIRED end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 7bf01c28a..8d102178f 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -586,7 +586,7 @@ class Epp::Domain < Domain msg: I18n.t(:object_status_prohibits_operation) } unless pending_deletable? - self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day.utc + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day set_pending_delete set_server_hold if server_holdable? save(validate: false) From 9ace5aafb1294ead273dac2b03feeafbaad60784 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 14 Apr 2016 17:22:18 +0300 Subject: [PATCH 114/247] 115595167-matching_column_name_changed --- app/controllers/application_controller.rb | 2 +- db/migrate/20160411140719_add_matching_column.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e3a611656..fac9d29f4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -56,7 +56,7 @@ class ApplicationController < ActionController::Base end def info_for_paper_trail - { svTRID: request.svTRID } + { uuid: request.uuid } end def user_for_paper_trail diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb index 9432c0ed2..1f0774824 100644 --- a/db/migrate/20160411140719_add_matching_column.rb +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -4,7 +4,7 @@ class AddMatchingColumn < ActiveRecord::Migration tables = [:log_domains, :log_contacts] tables.each do |table| - add_column table, :svTRID, :text + add_column table, :uuid, :text end end From c9c4e82989d1e9ab3bf5ac5aaf08fa27b17456be Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 14 Apr 2016 17:33:07 +0300 Subject: [PATCH 115/247] 115595167-log_table_list_changed --- db/migrate/20160411140719_add_matching_column.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb index 1f0774824..c16aef530 100644 --- a/db/migrate/20160411140719_add_matching_column.rb +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -1,7 +1,12 @@ class AddMatchingColumn < ActiveRecord::Migration def change - tables = [:log_domains, :log_contacts] + tables = [:log_account_activities, :log_accounts, :log_addresses, :log_api_users, :log_bank_statements, + :log_bank_transactions, :log_blocked_domains, :log_certificates, :log_contact_statuses, :log_contacts, + :log_countries, :log_dnskeys, :log_domain_contacts, :log_domain_statuses, :log_domain_transfers, + :log_domains, :log_invoice_items, :log_invoices, :log_keyrelays, :log_messages, :log_nameservers, + :log_pricelists, :log_registrars, :log_reserved_domains, :log_settings, :log_users, :log_white_ips, + :log_zonefile_settings] tables.each do |table| add_column table, :uuid, :text From c09c039f3cac8658ee591e3b889ea151d485caae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 15 Apr 2016 10:05:57 +0300 Subject: [PATCH 116/247] changed pending update and delete rejection messages [bug 117124725] --- config/locales/en.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 6372d401d..fd864ddf3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -827,16 +827,16 @@ en: domain_registrant_change_confirmed_body: 'You have successfully submitted domain registrant change confirmation. You will receive email confirmation.' registrant_domain_verification_confirmed: 'Domain registrant change has successfully received.' registrant_domain_verification_confirmed_failed: 'Something went wrong.' - domain_registrant_change_rejected_title: 'Domain registrant change has been rejected' - domain_registrant_change_rejected_body: 'You have rejected domain registrant change.' + domain_registrant_change_rejected_title: 'Domain registrant change rejection has been received' + domain_registrant_change_rejected_body: 'You have rejected domain registrant change. You will receive confirmation by email.' registrant_domain_verification_rejected: 'Domain registrant change has been rejected successfully.' registrant_domain_verification_rejected_failed: 'Something went wrong.' domain_delete_title: 'Please confirm or reject domain deletation' domain_delete_body: 'There is a request to delete a domain. Before doing it we need your confirmation.' domain_delete_confirmed_title: 'Domain deletion has been received successfully' domain_delete_confirmed_body: 'You have successfully submitted delete confirmation. You will receive registry final confirmation to email.' - domain_delete_rejected_title: 'Domain deletion has been rejected successfully' - domain_delete_rejected_body: 'You have rejected domain deletion.' + domain_delete_rejected_title: 'Domain deletion rejection has been received successfully' + domain_delete_rejected_body: 'You have rejected pending domain deletion. You will receive confirmation by email.' no_permission: 'No permission' access_denied: 'Access denied' common_name: 'Common name' From 8e1ce321438345b5b5dfcfa9526b34e7bcc5e872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 15 Apr 2016 11:10:40 +0300 Subject: [PATCH 117/247] fixed incorrect pending delete confirm page messages [bug 117124725] --- .../registrant/domain_delete_confirms_controller.rb | 8 ++++---- config/locales/en.yml | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb index f6f05d628..209456808 100644 --- a/app/controllers/registrant/domain_delete_confirms_controller.rb +++ b/app/controllers/registrant/domain_delete_confirms_controller.rb @@ -22,18 +22,18 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController verification_token: params[:token]) if params[:rejected] if @registrant_verification.domain_registrant_delete_reject! - flash[:notice] = t(:registrant_domain_verification_rejected) + flash[:notice] = t(:registrant_domain_delete_rejected) redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) else - flash[:alert] = t(:registrant_domain_verification_rejected_failed) + flash[:alert] = t(:registrant_domain_delete_rejected_failed) return render 'show' end elsif params[:confirmed] if @registrant_verification.domain_registrant_delete_confirm! - flash[:notice] = t(:registrant_domain_verification_confirmed) + flash[:notice] = t(:registrant_domain_delete_confirmed) redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) else - flash[:alert] = t(:registrant_domain_verification_confirmed_failed) + flash[:alert] = t(:registrant_domain_delete_confirmed_failed) return render 'show' end end diff --git a/config/locales/en.yml b/config/locales/en.yml index fd864ddf3..de5891c77 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -831,10 +831,14 @@ en: domain_registrant_change_rejected_body: 'You have rejected domain registrant change. You will receive confirmation by email.' registrant_domain_verification_rejected: 'Domain registrant change has been rejected successfully.' registrant_domain_verification_rejected_failed: 'Something went wrong.' - domain_delete_title: 'Please confirm or reject domain deletation' + domain_delete_title: 'Please confirm or reject domain deletion' domain_delete_body: 'There is a request to delete a domain. Before doing it we need your confirmation.' + registrant_domain_delete_confirmed: 'Setting the domain up for deletion...' + registrant_domain_delete_confirmed_failed: 'Something went wrong.' domain_delete_confirmed_title: 'Domain deletion has been received successfully' domain_delete_confirmed_body: 'You have successfully submitted delete confirmation. You will receive registry final confirmation to email.' + registrant_domain_delete_rejected: 'Rejecting the domain deletion...' + registrant_domain_delete_rejected_failed: 'Something went wrong.' domain_delete_rejected_title: 'Domain deletion rejection has been received successfully' domain_delete_rejected_body: 'You have rejected pending domain deletion. You will receive confirmation by email.' no_permission: 'No permission' From 96d5ae579ca7fa6877e9cdc267a694bd2a4a633d Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 15 Apr 2016 13:02:49 +0300 Subject: [PATCH 118/247] 115595167-logs_migration --- app/api/repp/api.rb | 3 ++- app/controllers/epp_controller.rb | 3 ++- db/migrate/20160411140719_add_matching_column.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/repp/api.rb b/app/api/repp/api.rb index 7a9ecd1e8..f52770920 100644 --- a/app/api/repp/api.rb +++ b/app/api/repp/api.rb @@ -49,7 +49,8 @@ module Repp response_code: status, api_user_name: current_user.try(:username), api_user_registrar: current_user.try(:registrar).try(:to_s), - ip: request.ip + ip: request.ip, + uuid: request.uuid }) end diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 49be47848..d692190eb 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -371,7 +371,8 @@ class EppController < ApplicationController response: @response, api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public', api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s), - ip: request.ip + ip: request.ip, + uuid: request.uuid }) end # rubocop: enable Metrics/CyclomaticComplexity diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb index c16aef530..a1b158313 100644 --- a/db/migrate/20160411140719_add_matching_column.rb +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -9,7 +9,7 @@ class AddMatchingColumn < ActiveRecord::Migration :log_zonefile_settings] tables.each do |table| - add_column table, :uuid, :text + add_column table, :uuid, :string end end From 7770a4d77833f7cf2c650419fb64f46ed7677d73 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 15 Apr 2016 13:49:48 +0300 Subject: [PATCH 119/247] Story#117690107 - strip contact email --- app/models/contact.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index 3e7ae4fc8..6c61ee698 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -46,6 +46,7 @@ class Contact < ActiveRecord::Base before_validation :to_upcase_country_code before_validation :prefix_code + before_validation :strip_email before_create :generate_auth_info before_update :manage_emails @@ -411,6 +412,10 @@ class Contact < ActiveRecord::Base "#{code} #{name}" end + def strip_email + self.email = email.to_s.strip + end + # what we can do load firstly by registrant # if total is smaller than needed, the load more From c87907c56a0af239c4ad25040be465d650de2de4 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 15 Apr 2016 14:29:57 +0300 Subject: [PATCH 120/247] 116209751-param_added --- app/models/depp/domain.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index afaff73fe..997a6b693 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -66,8 +66,9 @@ module Depp def delete(domain_params) xml = epp_xml.delete({ - name: { value: domain_params[:name] } - }, Depp::Domain.construct_custom_params_hash(domain_params)) + name: { value: domain_params[:name] }}, + Depp::Domain.construct_custom_params_hash(domain_params), + (domain_params[:verified].present? && 'yes')) current_user.request(xml) end From 7043097ec0cdb5aff8f02700ffee6b1a077dcec5 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 17 Apr 2016 15:12:10 +0300 Subject: [PATCH 121/247] 117131083-timezone_precision --- app/models/domain.rb | 6 +++--- app/models/epp/domain.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index a2ecc5451..7d383f6c9 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -575,7 +575,7 @@ class Domain < ActiveRecord::Base statuses << DomainStatus::SERVER_MANUAL_INZONE end - self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day unless force_delete_at + self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day unless force_delete_at transaction do save!(validate: false) registrar.messages.create!( @@ -604,7 +604,7 @@ class Domain < ActiveRecord::Base def set_graceful_expired self.outzone_at = valid_to + Setting.expire_warning_period.days - self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day + self.delete_at = (outzone_at + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day self.statuses |= [DomainStatus::EXPIRED] end @@ -612,7 +612,7 @@ class Domain < ActiveRecord::Base # TODO: currently valid_to attribute update logic is open # self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit) self.outzone_at = Time.zone.now + Setting.expire_warning_period.days - self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day statuses << DomainStatus::EXPIRED end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 8d102178f..69bb101f8 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -586,7 +586,7 @@ class Epp::Domain < Domain msg: I18n.t(:object_status_prohibits_operation) } unless pending_deletable? - self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).beginning_of_day + self.delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day set_pending_delete set_server_hold if server_holdable? save(validate: false) From 8ab42450cad35c94f508591ffb14799acd8344a6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 18 Apr 2016 12:07:00 +0300 Subject: [PATCH 122/247] Story#117612061 - do not send email if it's contact was removed --- app/mailers/contact_mailer.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 08beae05d..731175d5d 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -4,6 +4,11 @@ class ContactMailer < ApplicationMailer def email_updated(old_email, email, contact_id, should_deliver) @contact = Contact.find_by(id: contact_id) @old_email = old_email + unless @contact + Rails.logger.info "Cannot send email in #{self.class.name}.#{__method__} with contact_id #{contact_id}. It cannot be found" + return + end + return unless email || @contact return if delivery_off?(@contact, should_deliver) From 5b32ba5e5875a4c8290b41b204fc004c3d93fb66 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 18 Apr 2016 12:07:13 +0300 Subject: [PATCH 123/247] Story#117612061 - do not send email if it's contact was removed --- app/mailers/contact_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 731175d5d..bbfecfca6 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -5,7 +5,7 @@ class ContactMailer < ApplicationMailer @contact = Contact.find_by(id: contact_id) @old_email = old_email unless @contact - Rails.logger.info "Cannot send email in #{self.class.name}.#{__method__} with contact_id #{contact_id}. It cannot be found" + Rails.logger.info "Cannot send email in #{self.class.name}##{__method__} with contact_id #{contact_id}. It cannot be found" return end From a82f096fef5328c4fde55ae95b9d65d78d23850c Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 18 Apr 2016 15:32:14 +0300 Subject: [PATCH 124/247] 117226457-name_for_contacts --- app/views/registrar/domains/partials/_contacts.haml | 3 ++- app/views/registrar/domains/partials/_general.haml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/registrar/domains/partials/_contacts.haml b/app/views/registrar/domains/partials/_contacts.haml index 536f256b7..93058923c 100644 --- a/app/views/registrar/domains/partials/_contacts.haml +++ b/app/views/registrar/domains/partials/_contacts.haml @@ -9,7 +9,8 @@ %th{class: 'col-xs-8'}= t(:id) %tbody - @data.css('contact').each do |x| + - registrant = Contact.find_by_code(x.text) %tr %td= x['type'] %td= x.text - + %td= registrant.name \ No newline at end of file diff --git a/app/views/registrar/domains/partials/_general.haml b/app/views/registrar/domains/partials/_general.haml index 4eb5285e7..5381d0865 100644 --- a/app/views/registrar/domains/partials/_general.haml +++ b/app/views/registrar/domains/partials/_general.haml @@ -10,8 +10,9 @@ %dt= t(:registrar) %dd= @data.css('clID').text + - registrant = Contact.find_by_code(@data.css('registrant').text) %dt= t(:registrant) - %dd= @data.css('registrant').text + %dd= "#{registrant.name} (#{@data.css('registrant').text})" %dt= t(:registered) %dd= @data.css('crDate').text From 16641ce2c28eaf5dfdfcdbb43483b2851cb1cfd9 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 18 Apr 2016 15:40:29 +0300 Subject: [PATCH 125/247] 117226457-css_changes --- app/views/registrar/domains/partials/_contacts.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/registrar/domains/partials/_contacts.haml b/app/views/registrar/domains/partials/_contacts.haml index 93058923c..b94f99ee2 100644 --- a/app/views/registrar/domains/partials/_contacts.haml +++ b/app/views/registrar/domains/partials/_contacts.haml @@ -6,11 +6,12 @@ %thead %tr %th{class: 'col-xs-4'}= t(:type) - %th{class: 'col-xs-8'}= t(:id) + %th{class: 'col-xs-4'}= t(:name) + %th{class: 'col-xs-4'}= t(:id) %tbody - @data.css('contact').each do |x| - registrant = Contact.find_by_code(x.text) %tr %td= x['type'] - %td= x.text - %td= registrant.name \ No newline at end of file + %td= registrant.name + %td= x.text \ No newline at end of file From efbadd10c0fab5f85efc73280101a12ba15b26e5 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 18 Apr 2016 18:09:24 +0300 Subject: [PATCH 126/247] 116209751-gemfile_modification --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d616cb534..f6dc77b0f 100644 --- a/Gemfile +++ b/Gemfile @@ -88,7 +88,9 @@ gem 'digidoc_client', '0.2.1' # epp gem 'epp', '1.4.2', github: 'internetee/epp' -gem 'epp-xml', '1.0.4' # EIS EPP XMLs +gem 'epp-xml', '1.0.4', + github: 'internetee/epp-xml', + ref: '287fe8705ca2f344ea670b922dd9f08635efc7af' # EIS EPP XMLs gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem) # que From dd0886f3075648265cd231882855040b51cb00d8 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 19 Apr 2016 11:04:07 +0300 Subject: [PATCH 127/247] 116209751-gemlock_update --- Gemfile.lock | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index dbc1e8e3c..d2a5dd926 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,6 +16,15 @@ GIT data_migrate (1.3.0) rails (>= 4.1.0) +GIT + remote: https://github.com/internetee/epp-xml.git + revision: 287fe8705ca2f344ea670b922dd9f08635efc7af + ref: 287fe8705ca2f344ea670b922dd9f08635efc7af + specs: + epp-xml (1.0.4) + activesupport (~> 4.1) + builder (~> 3.2) + GIT remote: https://github.com/internetee/epp.git revision: 505c3f2739eb1da918e54111aecfb138a822739d From 8b49c3882033636a7653419116eda27f730ee5a3 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 19 Apr 2016 11:20:04 +0300 Subject: [PATCH 128/247] 116209751-gemfile.lock --- Gemfile.lock | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d2a5dd926..591643057 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,9 +200,6 @@ GEM docile (1.1.5) domain_name (0.5.25) unf (>= 0.0.5, < 1.0.0) - epp-xml (1.0.4) - activesupport (~> 4.1) - builder (~> 3.2) equalizer (0.0.11) erubis (2.7.0) execjs (2.6.0) @@ -598,7 +595,7 @@ DEPENDENCIES devise (= 3.5.4) digidoc_client (= 0.2.1) epp (= 1.4.2)! - epp-xml (= 1.0.4) + epp-xml (= 1.0.4)! fabrication (= 2.13.2) faker (= 1.4.3) figaro (= 1.1.1) From 0c738a5cba6981c17290a7aa29ac2ed824afda08 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 19 Apr 2016 11:57:20 +0300 Subject: [PATCH 129/247] Story#115762063 - add dots before secure code in history --- app/views/admin/domains/partials/_version.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index b7a790e7c..8e018a392 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -106,7 +106,8 @@ = ns.flags = ns.protocol = ns.alg - = ns.public_key.to_s[-20,20] + - if ns.public_key.present? + ...#{ns.public_key.to_s[-20,20]} %td{class: changing_css_class(version,"registrar_id")} - if domain.registrar From b8df59d2ff8a990a0bcdb3703077765be2e757ba Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 19 Apr 2016 12:28:41 +0300 Subject: [PATCH 130/247] 117702653-csv_fix --- app/models/account_activity.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb index 3a0e7dc30..c6523be33 100644 --- a/app/models/account_activity.rb +++ b/app/models/account_activity.rb @@ -6,7 +6,6 @@ class AccountActivity < ActiveRecord::Base belongs_to :bank_transaction belongs_to :invoice - attr_accessor :registrar CREATE = 'create' RENEW = 'renew' @@ -24,14 +23,15 @@ class AccountActivity < ActiveRecord::Base end def to_csv - attributes = %w(registrar description activity_type created_at sum) + attributes = %w(description activity_type created_at sum) CSV.generate(headers: true) do |csv| csv << %w(registrar description activity_type receipt_date sum) all.each do |x| # rubocop:disable Rails/FindEach - x.registrar = Registrar.find(x.account_id).try(:code) - csv << attributes.map { |attr| x.send(attr) } + attrs = [x.account.registrar.try(:code)] + attrs += attributes.map { |attr| x.send(attr) } + csv << attrs end end end From 62d6c531802a09ff7ed6ac15396bd201bff978a1 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 19 Apr 2016 19:38:33 +0300 Subject: [PATCH 131/247] 115595167-frame_present --- app/controllers/epp_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index d692190eb..de1002604 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -361,7 +361,7 @@ class EppController < ApplicationController if request_command == 'login' && frame.present? frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]]+)>([^<])+<\/eis:legalDocument>/, "[FILTERED]") + trimmed_request = frame.gsub(/]+)>([^<])+<\/eis:legalDocument>/, "[FILTERED]") if frame.present? ApiLog::EppLog.create({ request: trimmed_request, From da1228a457b646d01a8f43ea8cd14e95e9ac8d5c Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 20 Apr 2016 13:43:35 +0300 Subject: [PATCH 132/247] 115595167-extra_columns --- db/migrate/20160411140719_add_matching_column.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb index a1b158313..48be2ac39 100644 --- a/db/migrate/20160411140719_add_matching_column.rb +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -11,7 +11,9 @@ class AddMatchingColumn < ActiveRecord::Migration tables.each do |table| add_column table, :uuid, :string end + + ApiLog::EppLog.connection.execute("ALTER TABLE epp_logs ADD COLUMN uuid varchar;") + ApiLog::ReppLog.connection.execute("ALTER TABLE repp_logs ADD COLUMN uuid varchar;") + end - - end From 5048b9309e22bb592af187cc01bd0d01147c144f Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 14:04:54 +0300 Subject: [PATCH 133/247] Story#117991277 - allow to update country code if ident type is birthday --- app/models/epp/contact.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 52fef7143..ff119024d 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -173,6 +173,8 @@ class Epp::Contact < Contact elsif ident_type == "birthday" && !ident[/\A\d{4}-\d{2}-\d{2}\z/] && (Date.parse(ident) rescue false) at.merge!(ident: ident_frame.text) at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present? + elsif ident_type == "birthday" && ident_country_code.blank? + at.merge!(ident_country_code: ident_frame.attr('cc')) elsif ident_type.blank? && ident_country_code.blank? at.merge!(ident_type: ident_frame.attr('type')) at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present? From 0d87f53e106b92ffeda1412af29f6aff81eb0a68 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 14:08:58 +0300 Subject: [PATCH 134/247] Story#117991277 - making commit --- app/models/epp/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index ff119024d..df2dabf78 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -173,7 +173,7 @@ class Epp::Contact < Contact elsif ident_type == "birthday" && !ident[/\A\d{4}-\d{2}-\d{2}\z/] && (Date.parse(ident) rescue false) at.merge!(ident: ident_frame.text) at.merge!(ident_country_code: ident_frame.attr('cc')) if ident_frame.attr('cc').present? - elsif ident_type == "birthday" && ident_country_code.blank? + elsif ident_type == "birthday" && ident_country_code.blank? at.merge!(ident_country_code: ident_frame.attr('cc')) elsif ident_type.blank? && ident_country_code.blank? at.merge!(ident_type: ident_frame.attr('type')) From c8ccac84f355ea2d84625e754d93bf7ef067828b Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 14:43:55 +0300 Subject: [PATCH 135/247] Story#117991277 - validate contact with birthday cannot be Estonian --- app/models/contact.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 3e7ae4fc8..090e64866 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -81,7 +81,7 @@ class Contact < ActiveRecord::Base ORG = 'org' PRIV = 'priv' - BIRTHDAY = 'birthday' + BIRTHDAY = 'birthday'.freeze PASSPORT = 'passport' IDENT_TYPES = [ @@ -252,6 +252,8 @@ class Contact < ActiveRecord::Base if ident.size != 8 || !(ident =~/\A[0-9]{8}\z/) errors.add(:ident, err_msg) end + when BIRTHDAY + errors.add(:ident, err_msg) end end end @@ -284,6 +286,10 @@ class Contact < ActiveRecord::Base !org? end + def birthday? + ident_type == BIRTHDAY + end + def generate_auth_info return if @generate_auth_info_disabled return if auth_info.present? From 045b285b3706107a396811daa0393f7f1e92c12e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 20 Apr 2016 15:35:32 +0300 Subject: [PATCH 136/247] fixed typos in contact update e-mail messages --- app/views/mailers/contact_mailer/email_updated.html.erb | 6 +++--- app/views/mailers/contact_mailer/email_updated.text.erb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/mailers/contact_mailer/email_updated.html.erb b/app/views/mailers/contact_mailer/email_updated.html.erb index cd5a75682..2c5a265e9 100644 --- a/app/views/mailers/contact_mailer/email_updated.html.erb +++ b/app/views/mailers/contact_mailer/email_updated.html.erb @@ -1,10 +1,10 @@ Tere <%= @contact.name %>

-Kontakti <%= @contact.name %> eposti aadress on muudetud
+Kontakti <%= @contact.name %> e-posti aadress on muudetud
endine aadress: <%= @old_email %>
uus aadress: <%= @contact.email %>

-Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %> +E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>

<% if @contact.related_domain_descriptions.present? %> Muudatusega seotud domeenid:
@@ -16,7 +16,7 @@ Muudatusega seotud domeenid:
Kontaktandmed:
Nimi: <%= @contact.name %>
Isikukood: <%= @contact.ident %>
-Epost: <%= @contact.email %>
+E-post: <%= @contact.email %>
Tel: <%= @contact.phone %>
Tänav: <%= @contact.street %>
Linn: <%= @contact.city %>
diff --git a/app/views/mailers/contact_mailer/email_updated.text.erb b/app/views/mailers/contact_mailer/email_updated.text.erb index a899c04c2..835ea2ad6 100644 --- a/app/views/mailers/contact_mailer/email_updated.text.erb +++ b/app/views/mailers/contact_mailer/email_updated.text.erb @@ -1,10 +1,10 @@ Tere <%= @contact.name %> -Kontakti <%= @contact.name %> eposti aadress on muudetud +Kontakti <%= @contact.name %> e-posti aadress on muudetud endine aadress: <%= @old_email %> uus aadress: <%= @contact.email %> -Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %> +E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %> <% if @contact.related_domain_descriptions.present? %> Muudatusega seotud domeenid: @@ -16,7 +16,7 @@ Muudatusega seotud domeenid: Kontaktandmed: Nimi: <%= @contact.name %> Isikukood: <%= @contact.ident %> -Epost: <%= @contact.email %> +E-post: <%= @contact.email %> Tel: <%= @contact.phone %> Tänav: <%= @contact.street %> Linn: <%= @contact.city %> From 10b7ce3eea586abd6bb132e8dac14110e47571ad Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 20 Apr 2016 16:04:29 +0300 Subject: [PATCH 137/247] Story#117612931 - contact touch is not regenerating all whoises once and once again --- app/models/contact.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index 090e64866..3cc42419f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -551,6 +551,9 @@ class Contact < ActiveRecord::Base end def update_related_whois_records + # not doing anything if no real changes + return if changes.slice(*(self.class.column_names - ["updated_at", "created_at", "statuses", "status_notes"])).empty? + names = related_domain_descriptions.keys UpdateWhoisRecordJob.enqueue(names, :domain) if names.present? end From ff33eaa03137327ea4efb78ddb86052777b11a85 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 20 Apr 2016 18:59:13 +0300 Subject: [PATCH 138/247] 108869472-like_query --- app/controllers/admin/domain_versions_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 463bd8739..88e681b8b 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -9,12 +9,14 @@ class Admin::DomainVersionsController < AdminController search_params = params[:q].deep_dup if search_params[:registrant] - registrant = Contact.find_by(name: search_params[:registrant].strip) + #registrants = Contact.find_by(name: search_params[:registrant].strip) + registrants = Contact.where("name like ?", "%#{search_params[:registrant].strip}%") search_params.delete(:registrant) end if search_params[:registrar] - registrar = Registrar.find_by(name: search_params[:registrar].strip) + #registrar = Registrar.find_by(name: search_params[:registrar].strip) + registrars = Registrar.where("name like ?", "%#{search_params[:registrar].strip}%") search_params.delete(:registrar) end @@ -30,8 +32,8 @@ class Admin::DomainVersionsController < AdminController end end - whereS += " AND object->>'registrant_id' = '#{registrant.id}'" if registrant - whereS += " AND object->>'registrar_id' = '#{registrar.id}'" if registrar + whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants + whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars versions = DomainVersion.includes(:item).where(whereS) @q = versions.search(params[:q]) From 16de6bfaea157c5d9eed35c28370d85ff7d58748 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 21 Apr 2016 11:03:13 +0300 Subject: [PATCH 139/247] 115595167-new_migration --- db/migrate/20160411140719_add_matching_column.rb | 4 ---- db/migrate/20160421074023_add_log_matching_column.rb | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20160421074023_add_log_matching_column.rb diff --git a/db/migrate/20160411140719_add_matching_column.rb b/db/migrate/20160411140719_add_matching_column.rb index 48be2ac39..bbc15d352 100644 --- a/db/migrate/20160411140719_add_matching_column.rb +++ b/db/migrate/20160411140719_add_matching_column.rb @@ -11,9 +11,5 @@ class AddMatchingColumn < ActiveRecord::Migration tables.each do |table| add_column table, :uuid, :string end - - ApiLog::EppLog.connection.execute("ALTER TABLE epp_logs ADD COLUMN uuid varchar;") - ApiLog::ReppLog.connection.execute("ALTER TABLE repp_logs ADD COLUMN uuid varchar;") - end end diff --git a/db/migrate/20160421074023_add_log_matching_column.rb b/db/migrate/20160421074023_add_log_matching_column.rb new file mode 100644 index 000000000..6ea1931a9 --- /dev/null +++ b/db/migrate/20160421074023_add_log_matching_column.rb @@ -0,0 +1,9 @@ +class AddLogMatchingColumn < ActiveRecord::Migration + + def change + + ApiLog::EppLog.connection.execute("ALTER TABLE epp_logs ADD COLUMN uuid varchar;") + ApiLog::ReppLog.connection.execute("ALTER TABLE repp_logs ADD COLUMN uuid varchar;") + + end +end From 16f0f940c8f1ad1f6459c1f9c3a50616d54b29cf Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 21 Apr 2016 12:38:15 +0300 Subject: [PATCH 140/247] Story#117991277 - switch off Contact's birthday and cc=EE validation on update for now --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 090e64866..57174296a 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -253,7 +253,7 @@ class Contact < ActiveRecord::Base errors.add(:ident, err_msg) end when BIRTHDAY - errors.add(:ident, err_msg) + errors.add(:ident, err_msg) if id.blank? # only for create action right now. Later for all of them end end end From a09e6b1a42679e02bd57010322bef4518ab2f2f3 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 21 Apr 2016 15:21:59 +0300 Subject: [PATCH 141/247] 108869472-new_qieries_and_views --- .../admin/contact_versions_controller.rb | 4 +-- app/views/admin/contact_versions/index.haml | 2 +- app/views/admin/contact_versions/show.haml | 34 +++++++++++-------- app/views/admin/domain_versions/show.haml | 20 ++++++++--- 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index 215d6203c..9c8d05e61 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -30,7 +30,7 @@ class Admin::ContactVersionsController < AdminController def show per_page = 7 @version = ContactVersion.find(params[:id]) - @q = ContactVersion.where(item_id: @version.item_id).order(created_at: :asc).search + @q = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc).search @versions = @q.result.page(params[:page]) @versions = @versions.per(per_page) end @@ -40,7 +40,7 @@ class Admin::ContactVersionsController < AdminController end def create_where_string(key, value) - " AND object->>'#{key}' ~ '#{value}'" + " AND object->>'#{key}' LIKE '%#{value}%'" end end diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index e39c20b1f..0e513f37b 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -11,7 +11,7 @@ .col-md-3 .form-group = f.label :id - = f.search_field :id, value: params[:q][:id], class: 'form-control', placeholder: t(:id) + = f.search_field :code, value: params[:q][:code], class: 'form-control', placeholder: t(:id) .col-md-3 .form-group = f.label :ident diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index 3d4785159..d48f22be6 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -19,14 +19,15 @@ %dt= t(:ident) %dd= ident_for(contact) - %dt= t(:email) - %dd= contact.email + - if contact.email.present? + %dt= t(:email) + %dd= contact.email - - if contact.phone + - if contact.phone.present? %dt= t(:phone) %dd= contact.phone - - if contact.fax + - if contact.fax.present? %dt= t(:fax) %dd= contact.fax @@ -50,20 +51,25 @@ %dt= t(:org_name) %dd= contact.org_name - %dt= t(:street) - %dd= contact.street.to_s.gsub("\n", '
').html_safe + - if contact.street.present? + %dt= t(:street) + %dd= contact.street.to_s.gsub("\n", '
').html_safe - %dt= t(:city) - %dd= contact.city + - if contact.city.present? + %dt= t(:city) + %dd= contact.city - %dt= t(:zip) - %dd= contact.zip + - if contact.zip.present? + %dt= t(:zip) + %dd= contact.zip - %dt= t(:state) - %dd= contact.state + - if contact.state.present? + %dt= t(:state) + %dd= contact.state - %dt= t(:country) - %dd= contact.country + - if contact.country.present? + %dt= t(:country) + %dd= contact.country %span{:style => "padding-right:10px; float: right;"} diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 9143abeed..206c274a2 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -13,7 +13,7 @@ .row .col-md-8 - .panel.panel-default{:style => "min-height:400px;"} + .panel.panel-default{:style => "min-height:450px;"} .panel-heading %h3.panel-title = l(@version.created_at, format: :short) @@ -24,7 +24,19 @@ %dt= t(:name) %dd= link_to(domain.name, admin_domain_path(@version.item_id)) %dt= t(:registered_at) - %dd= l(domain.registered_at, format: :short) + %dd + = l(domain.registered_at, format: :short) + + %dt= t(:created) + %dd + = l(domain.created_at, format: :short) + + %dt= t(:updated) + %dd + = l(domain.updated_at, format: :short) + + %br + %dt= t(:statuses) %dd - if domain.statuses.present? @@ -63,7 +75,7 @@ %br %dt= t(:registrar) %dd= domain.registrar.name - %span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"} + %span{:style => "padding-right:10px; float: right; bottom: 10px;"} - if @version.previous = link_to(t(:previous), admin_domain_version_path(@version.previous.id), @@ -80,7 +92,7 @@ %span= t(:next) .col-md-4 - .panel.panel-default{:style => "min-height:400px;"} + .panel.panel-default{:style => "min-height:450px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| - if vs.id == @version.id and vs.reify From 76d5c96612d17ab829fa74cea8375c51bb069357 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 21 Apr 2016 16:19:47 +0300 Subject: [PATCH 142/247] 108869472-deleted_old_code --- app/controllers/admin/domain_versions_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 88e681b8b..cbc3205a3 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -8,14 +8,12 @@ class Admin::DomainVersionsController < AdminController @versions = @q.result.page(params[:page]) search_params = params[:q].deep_dup - if search_params[:registrant] - #registrants = Contact.find_by(name: search_params[:registrant].strip) + if search_params[:registrant].present? registrants = Contact.where("name like ?", "%#{search_params[:registrant].strip}%") search_params.delete(:registrant) end - if search_params[:registrar] - #registrar = Registrar.find_by(name: search_params[:registrar].strip) + if search_params[:registrar].present? registrars = Registrar.where("name like ?", "%#{search_params[:registrar].strip}%") search_params.delete(:registrar) end From 95dce72bd69707349c6b38e5af02eeb4102c7b00 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 21 Apr 2016 16:21:19 +0300 Subject: [PATCH 143/247] 108869472-template_view_modified --- app/views/admin/domain_versions/show.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 206c274a2..c384e4efb 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -1,3 +1,6 @@ +- domain = Domain.new(@version.object.to_h) +- @version.object_changes.to_h.each{|k,v| domain[k]=v.last} + - if @version - children = HashWithIndifferentAccess.new(@version.children) - nameservers = Nameserver.where(id: children[:nameservers]) @@ -6,8 +9,6 @@ - registrant = Contact.where(id: children[:registrant]) - event = @version.event - creator = plain_username(@version.terminator) - - domain = Domain.new(@version.object.to_h) - - @version.object_changes.to_h.each{|k,v| domain[k]=v.last} = render 'shared/title', name: domain.name From 17765cbf1454b76ad651585c7bacc37708d729a2 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 22 Apr 2016 11:12:07 +0300 Subject: [PATCH 144/247] Story#115762063 - escape dots for haml --- app/views/admin/domain_versions/show.haml | 5 +++-- app/views/admin/domains/partials/_version.haml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 3e1fd14b9..e413679be 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -80,8 +80,9 @@ = ns[:flags] = ns[:protocol] = ns[:alg] - = ns[:public_key].to_s[-20,20] - %br + - if ns[:public_key].present? + \...#{ns[:public_key].to_s[-20,20]} + %br %dt= t(:registrar) %dd{class: changing_css_class(@version,"registrar_id")} diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 8e018a392..7cd9a497e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -107,7 +107,7 @@ = ns.protocol = ns.alg - if ns.public_key.present? - ...#{ns.public_key.to_s[-20,20]} + \...#{ns.public_key.to_s[-20,20]} %td{class: changing_css_class(version,"registrar_id")} - if domain.registrar From 6a49099b5282b8a2de5df6d7d3b2c3defba465c7 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 22 Apr 2016 15:13:16 +0300 Subject: [PATCH 145/247] 116209751-template_fix --- app/views/registrar/domains/delete.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/registrar/domains/delete.haml b/app/views/registrar/domains/delete.haml index 706587629..f90f8ce04 100644 --- a/app/views/registrar/domains/delete.haml +++ b/app/views/registrar/domains/delete.haml @@ -8,9 +8,9 @@ .panel-body .form-group .col-md-4.control-label - = label_tag :verified, t(:verified) + = label_tag 'domain[verified]', t(:verified) .col-md-6 - = check_box_tag :verified, '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + = check_box_tag 'domain[verified]', '1', domain[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" .form-group .col-md-4.control-label From 7e1ad772585f8129308167edec766ef6f6419a73 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 24 Apr 2016 16:26:16 +0300 Subject: [PATCH 146/247] 116209751-ref_to_another_commit --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f6dc77b0f..d9ad7593a 100644 --- a/Gemfile +++ b/Gemfile @@ -90,7 +90,7 @@ gem 'digidoc_client', '0.2.1' gem 'epp', '1.4.2', github: 'internetee/epp' gem 'epp-xml', '1.0.4', github: 'internetee/epp-xml', - ref: '287fe8705ca2f344ea670b922dd9f08635efc7af' # EIS EPP XMLs + ref: '009611d78a3bebab33c04f73968f4606863f4b93' # EIS EPP XMLs gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem) # que diff --git a/Gemfile.lock b/Gemfile.lock index 591643057..c4ace1088 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,8 +18,8 @@ GIT GIT remote: https://github.com/internetee/epp-xml.git - revision: 287fe8705ca2f344ea670b922dd9f08635efc7af - ref: 287fe8705ca2f344ea670b922dd9f08635efc7af + revision: 009611d78a3bebab33c04f73968f4606863f4b93 + ref: 009611d78a3bebab33c04f73968f4606863f4b93 specs: epp-xml (1.0.4) activesupport (~> 4.1) From 5025758bc1b96954425f80c2ef1feaef42204824 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 24 Apr 2016 16:49:59 +0300 Subject: [PATCH 147/247] 116209751-typo --- app/views/registrar/domains/delete.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/registrar/domains/delete.haml b/app/views/registrar/domains/delete.haml index f90f8ce04..ab1bdfa31 100644 --- a/app/views/registrar/domains/delete.haml +++ b/app/views/registrar/domains/delete.haml @@ -10,7 +10,7 @@ .col-md-4.control-label = label_tag 'domain[verified]', t(:verified) .col-md-6 - = check_box_tag 'domain[verified]', '1', domain[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" + = check_box_tag 'domain[verified]', '1', params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" .form-group .col-md-4.control-label From f45b4978766855c0463acb58d34394970e0b01ff Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 25 Apr 2016 18:13:52 +0300 Subject: [PATCH 148/247] 117350717-sorting_fixes --- app/controllers/admin/contacts_controller.rb | 10 +++++----- app/controllers/admin/domains_controller.rb | 2 +- app/views/admin/account_activities/index.haml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 3a05bb759..5156578db 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -10,22 +10,22 @@ class Admin::ContactsController < AdminController search_params[:registrant_domains_id_not_null] = 1 end - @q = Contact.includes(:registrar).search(search_params) + @q = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) @contacts = @q.result(distinct: :true).page(params[:page]) if params[:statuses_contains] - contacts = Contact.includes(:registrar).where( + contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').where( "contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" ) else - contacts = Contact.includes(:registrar) + contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name') end contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1') normalize_search_parameters do - @q = contacts.search(search_params) - @contacts = @q.result(distinct: :true).page(params[:page]) + @q = contacts.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) + @contacts = @q.result.uniq.page(params[:page]) end @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 377912bad..e619c4da9 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -9,7 +9,7 @@ class Admin::DomainsController < AdminController params[:q] ||= {} if params[:statuses_contains] domains = Domain.includes(:registrar, :registrant).where( - "statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" + "domains.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" ) else domains = Domain.includes(:registrar, :registrant) diff --git a/app/views/admin/account_activities/index.haml b/app/views/admin/account_activities/index.haml index e29f12f75..0a60e0809 100644 --- a/app/views/admin/account_activities/index.haml +++ b/app/views/admin/account_activities/index.haml @@ -56,7 +56,7 @@ %thead %tr %th{class: 'col-xs-2'} - = sort_link(@q, 'registrar') + = sort_link(@q, 'account_registrar_code', t(:registrar)) %th{class: 'col-xs-3'} = sort_link(@q, 'description') %th{class: 'col-xs-2'} From 47483f8d7576bdc1cb3b4681b8b472ce68d3c4fa Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 26 Apr 2016 11:06:49 +0300 Subject: [PATCH 149/247] Story#118300251 - remove old not needed code --- app/controllers/admin/domain_versions_controller.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 44a2087cd..389530098 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -1,18 +1,8 @@ class Admin::DomainVersionsController < AdminController load_and_authorize_resource - # rubocop:disable Style/GuardClause def index @domain = Domain.where(id: params[:domain_id]).includes({versions: :item}).first @versions = @domain.versions - - # Depricated it had to load legal document. We may do it by parsing and adding link. - # if @domain.pending_json.present? - # frame = Nokogiri::XML(@domain.pending_json['frame']) - # @pending_user = User.find(@domain.pending_json['current_user_id']) - # @pending_domain = Epp::Domain.find(@domain.id) - # @pending_domain.update(frame, @pending_user, false) - # end end - # rubocop:enable Style/GuardClause end From 576fa914b4112ed9f9bd9c7918d8fe88d055b059 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 13:15:13 +0300 Subject: [PATCH 150/247] 114677695-utf8_nameservers --- app/models/nameserver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index ccedf0880..168b5129e 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -8,7 +8,7 @@ class Nameserver < ActiveRecord::Base # scope :owned_by_registrar, -> (registrar) { joins(:domain).where('domains.registrar_id = ?', registrar.id) } # rubocop: disable Metrics/LineLength - validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } + validates :hostname, domain_name: true # validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true } # validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } validate :val_ipv4 From 096c23f55e9a7ef292282d2703501b90336ff679 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:09:51 +0300 Subject: [PATCH 151/247] 117806281-clickable_actions --- app/models/concerns/versions.rb | 7 +++++++ app/views/admin/domains/partials/_version.haml | 14 +++++++++++++- app/views/admin/domains/versions.haml | 6 +++--- config/locales/en.yml | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index 49c4298f2..d15bd297e 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -47,6 +47,13 @@ module Versions user end + def get_request_by_uuid(uuid) + return unless uuid + ApiLog::EppLog.find_by(uuid: uuid).request + end + + + # callbacks def touch_domain_version domain.try(:touch_with_version) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 7cd9a497e..4f87efe0e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,10 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - = event + - if (event == 'update' || event = 'create') && version + = link_to event, '#', class: 'js-event' + - else + = event %br = creator - if version @@ -115,6 +118,15 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name + - if (event == 'create' || event == 'update') && version + %tr.js-event{ style: 'display: none;' } + %td{colspan: 8} + %pre + - if version.uuid + = Nokogiri::XML(Epp::ApiLog::EppLog.find_by(uuid: uuid).request) + - else + = t(:cant_match_version) + - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } %td{colspan: 8} diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index b803808aa..df5085e9b 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -37,9 +37,9 @@ domain: version.reify, version: version.previous :coffee - $(document).on 'click', '.js-pending-toggle', (e) -> + $(document).on 'click', '.js-pending-toggle, .js-event', (e) -> e.preventDefault() - $(document).on 'mousedown', '.js-pending-toggle', (e) -> + $(document).on 'mousedown', '.js-pending-toggle, .js-event', (e) -> target = $(e.target) - target.parents('tr').next('tr.js-pending').toggle() + target.parents('tr').next('tr.js-pending, tr.js-event').toggle() diff --git a/config/locales/en.yml b/config/locales/en.yml index faa4c4595..c4bc211c1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -941,3 +941,4 @@ en: add_blocked_domain: 'Add domain to blocked list' edit_pw: 'Edit Pw' optional: 'Optional' + cant_match_version: 'Impossible match version with request' From d66e5e3c96ccba60af73b103310e4e82ae84ebbd Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:18:06 +0300 Subject: [PATCH 152/247] '117806281-method_delete --- app/models/concerns/versions.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/models/concerns/versions.rb b/app/models/concerns/versions.rb index d15bd297e..49c4298f2 100644 --- a/app/models/concerns/versions.rb +++ b/app/models/concerns/versions.rb @@ -47,13 +47,6 @@ module Versions user end - def get_request_by_uuid(uuid) - return unless uuid - ApiLog::EppLog.find_by(uuid: uuid).request - end - - - # callbacks def touch_domain_version domain.try(:touch_with_version) From e3f37081087c7a621b2893201592a66dd7c10b16 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 15:33:17 +0300 Subject: [PATCH 153/247] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 4f87efe0e..74147b84f 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -123,7 +123,7 @@ %td{colspan: 8} %pre - if version.uuid - = Nokogiri::XML(Epp::ApiLog::EppLog.find_by(uuid: uuid).request) + = Nokogiri::XML(ApiLog::EppLog.find_by(uuid: version.uuid).request) - else = t(:cant_match_version) From 09f28e04702d4dd426f8fd9592e0287a34235fe5 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Apr 2016 18:57:20 +0300 Subject: [PATCH 154/247] 108869472-default_page_handler --- app/controllers/admin/domain_versions_controller.rb | 13 ++++++++++++- app/views/admin/domain_versions/archive.haml | 2 +- app/views/admin/domain_versions/show.haml | 12 ++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index cbc3205a3..17748b482 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -45,7 +45,18 @@ class Admin::DomainVersionsController < AdminController per_page = 7 @version = DomainVersion.find(params[:id]) @q = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc).search - @versions = @q.result.page(params[:page]) + + if (@q.result.count > per_page) && params[:page] == 'default' + page = 1 + @q.result.each_with_index do |v, i| + break if v.id == @version.id and page = (i / per_page) + 1 + end + params[:page] = page + @versions = @q.result.page(page) + else + @versions = @q.result.page(params[:page]) + end + @versions = @versions.per(per_page) end diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 31fb9bc9d..de81af1e4 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -60,7 +60,7 @@ - version.object_changes.to_h.each{|k,v| domain[k]=v.last} %tr - %td= link_to(domain.name, admin_domain_version_path(version.id)) + %td= link_to(domain.name, admin_domain_version_path(version.id, :page => 'default')) %td - if domain.registrant = domain.registrant diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index c384e4efb..f169174f5 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -76,17 +76,17 @@ %br %dt= t(:registrar) %dd= domain.registrar.name - %span{:style => "padding-right:10px; float: right; bottom: 10px;"} + %div{:style => "margin: 20px 20px; clear:both;"} - if @version.previous = link_to(t(:previous), - admin_domain_version_path(@version.previous.id), + admin_domain_version_path(@version.previous.id, :page => 'default'), class: 'btn btn-primary') - else %a.btn.btn-primary.disabled{:href => "#"} %span= t(:previous) - if @version.next = link_to(t(:next), - admin_domain_version_path(@version.next.id), + admin_domain_version_path(@version.next.id, :page => 'default'), class: 'btn btn-default') - else %a.btn.btn-default.disabled{:href => "#"} @@ -96,14 +96,14 @@ .panel.panel-default{:style => "min-height:450px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| - - if vs.id == @version.id and vs.reify + - if vs.id == @version.id %li.active - = link_to admin_domain_version_path(vs.id) do + = link_to admin_domain_version_path(vs.id, :page => 'default') do = l(vs.created_at, format: :short) = vs.event - else %li - = link_to admin_domain_version_path(vs.id) do + = link_to admin_domain_version_path(vs.id, :page => 'default') do = l(vs.created_at, format: :short) = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} From 97c4bf00976475211d9e1daa60ddfd85c029230f Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 29 Apr 2016 14:18:44 +0300 Subject: [PATCH 155/247] 108869472-pagination_modification --- .../admin/domain_versions_controller.rb | 20 +++++++++---------- app/views/admin/domain_versions/archive.haml | 2 +- app/views/admin/domain_versions/show.haml | 10 +++++----- .../kaminari/admin/_first_page.html.haml | 11 ++++++++++ app/views/kaminari/admin/_gap.html.haml | 8 ++++++++ app/views/kaminari/admin/_last_page.html.haml | 9 +++++++++ app/views/kaminari/admin/_next_page.html.haml | 9 +++++++++ app/views/kaminari/admin/_page.html.haml | 12 +++++++++++ app/views/kaminari/admin/_paginator.html.haml | 18 +++++++++++++++++ app/views/kaminari/admin/_prev_page.html.haml | 11 ++++++++++ 10 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 app/views/kaminari/admin/_first_page.html.haml create mode 100644 app/views/kaminari/admin/_gap.html.haml create mode 100644 app/views/kaminari/admin/_last_page.html.haml create mode 100644 app/views/kaminari/admin/_next_page.html.haml create mode 100644 app/views/kaminari/admin/_page.html.haml create mode 100644 app/views/kaminari/admin/_paginator.html.haml create mode 100644 app/views/kaminari/admin/_prev_page.html.haml diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 17748b482..1a469ddeb 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -43,21 +43,19 @@ class Admin::DomainVersionsController < AdminController def show per_page = 7 - @version = DomainVersion.find(params[:id]) - @q = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc).search + @version = DomainVersion.find(params[:id]) + @versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc) - if (@q.result.count > per_page) && params[:page] == 'default' - page = 1 - @q.result.each_with_index do |v, i| - break if v.id == @version.id and page = (i / per_page) + 1 - end + # what we do is calc amount of results until needed version + # then we cacl which page it is + if params[:page].blank? + counter = @versions.where("created_at > ?", @version.created_at).count + page = counter / per_page + page += 1 if (counter % per_page) != 0 params[:page] = page - @versions = @q.result.page(page) - else - @versions = @q.result.page(params[:page]) end - @versions = @versions.per(per_page) + @versions = @versions.page(params[:page]).per(per_page) end def search diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index de81af1e4..31fb9bc9d 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -60,7 +60,7 @@ - version.object_changes.to_h.each{|k,v| domain[k]=v.last} %tr - %td= link_to(domain.name, admin_domain_version_path(version.id, :page => 'default')) + %td= link_to(domain.name, admin_domain_version_path(version.id)) %td - if domain.registrant = domain.registrant diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index f169174f5..2a245ab1f 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -79,14 +79,14 @@ %div{:style => "margin: 20px 20px; clear:both;"} - if @version.previous = link_to(t(:previous), - admin_domain_version_path(@version.previous.id, :page => 'default'), + admin_domain_version_path(@version.previous.id), class: 'btn btn-primary') - else %a.btn.btn-primary.disabled{:href => "#"} %span= t(:previous) - if @version.next = link_to(t(:next), - admin_domain_version_path(@version.next.id, :page => 'default'), + admin_domain_version_path(@version.next.id), class: 'btn btn-default') - else %a.btn.btn-default.disabled{:href => "#"} @@ -98,13 +98,13 @@ - @versions.each do |vs| - if vs.id == @version.id %li.active - = link_to admin_domain_version_path(vs.id, :page => 'default') do + = link_to admin_domain_version_path(vs) do = l(vs.created_at, format: :short) = vs.event - else %li - = link_to admin_domain_version_path(vs.id, :page => 'default') do + = link_to admin_domain_version_path(vs) do = l(vs.created_at, format: :short) = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} - = paginate @versions + = paginate @versions, theme: :admin diff --git a/app/views/kaminari/admin/_first_page.html.haml b/app/views/kaminari/admin/_first_page.html.haml new file mode 100644 index 000000000..c5bbf13e1 --- /dev/null +++ b/app/views/kaminari/admin/_first_page.html.haml @@ -0,0 +1,11 @@ +-# Link to the "First" page +-# available local variables +-# url: url to the first page +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span.first + - param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name + - urlik = url_for( params.merge(param_name => 1, :only_path => true)) + = link_to_unless current_page.first?, t('views.pagination.first').html_safe, urlik, :remote => remote diff --git a/app/views/kaminari/admin/_gap.html.haml b/app/views/kaminari/admin/_gap.html.haml new file mode 100644 index 000000000..dd5789cc1 --- /dev/null +++ b/app/views/kaminari/admin/_gap.html.haml @@ -0,0 +1,8 @@ +-# Non-link tag that stands for skipped pages... +-# available local variables +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span.page.gap + = t('views.pagination.truncate').html_safe diff --git a/app/views/kaminari/admin/_last_page.html.haml b/app/views/kaminari/admin/_last_page.html.haml new file mode 100644 index 000000000..cdddb9e7c --- /dev/null +++ b/app/views/kaminari/admin/_last_page.html.haml @@ -0,0 +1,9 @@ +-# Link to the "Last" page +-# available local variables +-# url: url to the last page +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span.last + = link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote diff --git a/app/views/kaminari/admin/_next_page.html.haml b/app/views/kaminari/admin/_next_page.html.haml new file mode 100644 index 000000000..2865dcd0c --- /dev/null +++ b/app/views/kaminari/admin/_next_page.html.haml @@ -0,0 +1,9 @@ +-# Link to the "Next" page +-# available local variables +-# url: url to the next page +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span.next + = link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote diff --git a/app/views/kaminari/admin/_page.html.haml b/app/views/kaminari/admin/_page.html.haml new file mode 100644 index 000000000..d583c58f1 --- /dev/null +++ b/app/views/kaminari/admin/_page.html.haml @@ -0,0 +1,12 @@ +-# Link showing page number +-# available local variables +-# page: a page object for "this" page +-# url: url to this page +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span{:class => "page#{' current' if page.current?}"} + - param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name + - urlik = url_for( params.merge(param_name => page.to_i, :only_path => true)) + = link_to_unless page.current?, page, urlik, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} diff --git a/app/views/kaminari/admin/_paginator.html.haml b/app/views/kaminari/admin/_paginator.html.haml new file mode 100644 index 000000000..4f33e2dee --- /dev/null +++ b/app/views/kaminari/admin/_paginator.html.haml @@ -0,0 +1,18 @@ +-# The container tag +-# available local variables +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +-# paginator: the paginator that renders the pagination tags inside += paginator.render do + %nav.pagination + = first_page_tag unless current_page.first? + = prev_page_tag unless current_page.first? + - each_page do |page| + - if page.left_outer? || page.right_outer? || page.inside_window? + = page_tag page + - elsif !page.was_truncated? + = gap_tag + = next_page_tag unless current_page.last? + = last_page_tag unless current_page.last? diff --git a/app/views/kaminari/admin/_prev_page.html.haml b/app/views/kaminari/admin/_prev_page.html.haml new file mode 100644 index 000000000..3b565fa6f --- /dev/null +++ b/app/views/kaminari/admin/_prev_page.html.haml @@ -0,0 +1,11 @@ +-# Link to the "Previous" page +-# available local variables +-# url: url to the previous page +-# current_page: a page object for the currently displayed page +-# total_pages: total number of pages +-# per_page: number of items to fetch per page +-# remote: data-remote +%span.prev + - param_name = current_page.instance_variable_get("@options")[:param_name] || Kaminari.config.param_name + - urlik = url_for( params.merge(param_name => current_page.to_i - 1, :only_path => true)) + = link_to_unless current_page.first?, t('views.pagination.previous').html_safe, urlik, :rel => 'prev', :remote => remote From d04f558af55b4fa840e4d0c8f3425ebcf4ceca09 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 29 Apr 2016 18:17:41 +0300 Subject: [PATCH 156/247] 114677695-converter_and_migration --- app/models/nameserver.rb | 10 +++++ ...9114732_add_puny_hostname_to_nameserver.rb | 9 ++++ lib/tasks/convert.rake | 42 +++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 db/migrate/20160429114732_add_puny_hostname_to_nameserver.rb diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 168b5129e..d86813908 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -16,6 +16,8 @@ class Nameserver < ActiveRecord::Base # rubocop: enable Metrics/LineLength before_validation :normalize_attributes + before_validation :hostname_to_utf + after_validation :add_hostname_puny delegate :name, to: :domain, prefix: true @@ -41,6 +43,14 @@ class Nameserver < ActiveRecord::Base self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase) end + def hostname_to_utf + self.hostname = SimpleIDN.to_unicode(hostname) + end + + def add_hostname_puny + self.hostname_puny = SimpleIDN.to_ascii(hostname) + end + def to_s hostname end diff --git a/db/migrate/20160429114732_add_puny_hostname_to_nameserver.rb b/db/migrate/20160429114732_add_puny_hostname_to_nameserver.rb new file mode 100644 index 000000000..368d9f144 --- /dev/null +++ b/db/migrate/20160429114732_add_puny_hostname_to_nameserver.rb @@ -0,0 +1,9 @@ +class AddPunyHostnameToNameserver < ActiveRecord::Migration + + def change + + add_column :nameservers, :hostname_puny, :string + execute "UPDATE nameservers n SET hostname_puny = n.hostname" + + end +end diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake index 35e68046c..47e0ec7c2 100644 --- a/lib/tasks/convert.rake +++ b/lib/tasks/convert.rake @@ -71,5 +71,47 @@ namespace :convert do end end end + + desc 'Convert nameservers hostname and hostname_puny' + task nameserves_hostname: :environment do + + start = Time.zone.now.to_f + count = 0 + puts '-----> Converting hostnames...' + + Nameserver.find_each(:batch_size => 1000) do |ns| + ns.hostname = SimpleIDN.to_unicode(ns.hostname) + ns.hostname_puny = SimpleIDN.to_ascii(ns.hostname_puny) + ns.save validate: false + count += 1 + puts "-----> Converted #{count} nameservers" if count % 1000 == 0 + end + puts "-----> Converted #{count} nameservers #{(Time.zone.now.to_f - start).round(2)} seconds" + + end + + desc 'Convert nameservers history hostname' + task nameserves_history_hostname: :environment do + + start = Time.zone.now.to_f + count = 0 + puts '-----> Converting hostnames history...' + + NameserverVersion.find_each do |ns| + if obj = ns.object + obj["hostname"] = SimpleIDN.to_unicode(obj["hostname"]) + ns.object = obj + end + + if (obj_c = ns.object_changes).present? + obj_c["name"].map!{|e| e ? SimpleIDN.to_unicode(e) : e } if obj_c["hostname"] + ns.object_changes = obj_c + end + count += 1 + ns.save! + end + puts "-----> Converted #{count} history rows #{(Time.zone.now.to_f - start).round(2)} seconds" + end + end From 00a1d70bc579327db857e17c1cc173e8d51835e4 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 3 May 2016 15:52:43 +0300 Subject: [PATCH 157/247] 111601356-ident_type_validation --- app/models/contact.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index 57174296a..d6d5369dd 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -33,6 +33,7 @@ class Contact < ActiveRecord::Base uniqueness: { message: :epp_id_taken }, format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } + validates :ident_type, inclusion: {in: %w( org priv birthday)} validate :val_ident_valid_format? validate :uniq_statuses? validate :validate_html From a5e9dde027913dfa63b41fddc9943731b6b17e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 5 May 2016 09:13:23 +0300 Subject: [PATCH 158/247] Fixed typos in automatic emails sent to notify about a pending registrant change request --- .../pending_update_notification_for_new_registrant.html.erb | 4 ++-- .../pending_update_notification_for_new_registrant.text.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb index 07de23117..cbf450d9d 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb @@ -15,9 +15,9 @@ Tänav: <%= @params[:registrant_street] %>
Linn: <%= @params[:registrant_city] %>
Riik: <%= @params[:registrant_country] %>

-Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab. +Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab.

-Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse. +Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.

Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad

diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb index 24005a58a..7db6f2f93 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb @@ -15,9 +15,9 @@ Tänav: <%= @params[:registrant_street] %> Linn: <%= @params[:registrant_city] %> Riik: <%= @params[:registrant_country] %> -Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiaks lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab. +Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule vaid juhul, kui domeeni hetkel kehtiv registreerija <%= @params[:old_registrant_name] %> omanikuvahetuse tähtaegselt kinnitab. -Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahtuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse. +Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse. Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad From 21da9bbc9b2c6f1976c61647b35644225b2f4873 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 5 May 2016 20:06:11 +0300 Subject: [PATCH 159/247] 117226457-uuid --- app/api/repp/api.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/repp/api.rb b/app/api/repp/api.rb index 7a9ecd1e8..27d0322b0 100644 --- a/app/api/repp/api.rb +++ b/app/api/repp/api.rb @@ -49,7 +49,8 @@ module Repp response_code: status, api_user_name: current_user.try(:username), api_user_registrar: current_user.try(:registrar).try(:to_s), - ip: request.ip + ip: request.ip, + uuid: request.try(:uuid) }) end From ce297dacd6e6fd037c73672cfad84b93fcf308a2 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 10 May 2016 15:18:20 +0300 Subject: [PATCH 160/247] 116209751-dublicate_deleted --- app/models/depp/domain.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index 997a6b693..f181d0000 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -214,10 +214,6 @@ module Depp rem_arr << { ns: rem_ns } if rem_ns.any? rem_arr << { _anonymus: rem_anon } if rem_anon.any? - if domain_params[:registrant] != old_domain_params[:registrant] - chg = [{ registrant: { value: domain_params[:registrant] } }] - end - if domain_params[:registrant] != old_domain_params[:registrant] chg = [{ registrant: { value: domain_params[:registrant] } }] if !domain_params[:verified].present? chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified] From 20b831af812dc291bc2da7357a2b55149ca48916 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 10 May 2016 17:24:40 +0300 Subject: [PATCH 161/247] 117806281-request_condition --- app/views/admin/domains/partials/_version.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 74147b84f..14f40309d 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -123,7 +123,11 @@ %td{colspan: 8} %pre - if version.uuid - = Nokogiri::XML(ApiLog::EppLog.find_by(uuid: version.uuid).request) + - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) + - if req + = Nokogiri::XML(req) + - else + = t(:cant_match_version) - else = t(:cant_match_version) From 729b2f150e7dfbc1b9c4e13afffab5651a8f82f2 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 11 May 2016 13:32:08 +0300 Subject: [PATCH 162/247] 118911315-data_type_change --- app/models/blocked_domain.rb | 2 +- app/models/reserved_domain.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/blocked_domain.rb b/app/models/blocked_domain.rb index 2e337dce4..3708dd6e6 100644 --- a/app/models/blocked_domain.rb +++ b/app/models/blocked_domain.rb @@ -40,7 +40,7 @@ class BlockedDomain < ActiveRecord::Base def generate_json h = HashWithIndifferentAccess.new h[:name] = self.name - h[:status] = 'Blocked' + h[:status] = ['Blocked'] h end diff --git a/app/models/reserved_domain.rb b/app/models/reserved_domain.rb index 9f36fcebc..e80b96c24 100644 --- a/app/models/reserved_domain.rb +++ b/app/models/reserved_domain.rb @@ -65,7 +65,7 @@ class ReservedDomain < ActiveRecord::Base def generate_json h = HashWithIndifferentAccess.new h[:name] = self.name - h[:status] = 'Reserved' + h[:status] = ['Reserved'] h end From 7bfbd0044fa9c81701ed93b06a7d9aa8fb1bca2b Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 12 May 2016 17:32:25 +0300 Subject: [PATCH 163/247] 114677695-validation_changes --- app/models/nameserver.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index d86813908..1dbb02d19 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -8,7 +8,7 @@ class Nameserver < ActiveRecord::Base # scope :owned_by_registrar, -> (registrar) { joins(:domain).where('domains.registrar_id = ?', registrar.id) } # rubocop: disable Metrics/LineLength - validates :hostname, domain_name: true + validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõÄÖÜÕ0-9][a-zA-ZäöüõÄÖÜÕ0-9\-]*[a-zA-ZäöüõÄÖÜÕ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } # validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true } # validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } validate :val_ipv4 @@ -16,9 +16,7 @@ class Nameserver < ActiveRecord::Base # rubocop: enable Metrics/LineLength before_validation :normalize_attributes - before_validation :hostname_to_utf - after_validation :add_hostname_puny - + delegate :name, to: :domain, prefix: true def epp_code_map @@ -43,18 +41,15 @@ class Nameserver < ActiveRecord::Base self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase) end - def hostname_to_utf - self.hostname = SimpleIDN.to_unicode(hostname) - end - - def add_hostname_puny - self.hostname_puny = SimpleIDN.to_ascii(hostname) - end - def to_s hostname end + def hostname=(hostname) + self[:hostname] = SimpleIDN.to_unicode(hostname) + self[:hostname_puny] = SimpleIDN.to_ascii(hostname) + end + def val_ipv4 regexp = /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/ ipv4.to_a.each do |ip| From 32620692cc85aa229e1e703436ac091f41e9e7c0 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 16 May 2016 11:34:55 +0300 Subject: [PATCH 164/247] 117806281-usability_changes --- app/views/admin/domains/partials/_version.haml | 10 +++++----- app/views/admin/domains/versions.haml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 14f40309d..16f8a300e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event = 'create') && version + - if (event == 'update' || event = 'create') && (version && version.uuid) = link_to event, '#', class: 'js-event' - else = event @@ -52,7 +52,7 @@ %br - if domain.pending_json.present? %p - = link_to t(:pending_epp), '#', class: 'js-pending-toggle' + = link_to t(:pending_epp), '#', class: 'js-pending' %td{class: changing_css_class(version, "period", "period_unit", "valid_from", "valid_to")} %p @@ -118,9 +118,9 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name - - if (event == 'create' || event == 'update') && version + - if (event == 'create' || event == 'update') && (version && version.uuid) %tr.js-event{ style: 'display: none;' } - %td{colspan: 8} + %td{colspan: 9} %pre - if version.uuid - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) @@ -133,7 +133,7 @@ - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } - %td{colspan: 8} + %td{colspan: 9} = preserve do %pre - formatted_req = Nokogiri::XML(domain.pending_json['frame']) diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index df5085e9b..cfef69872 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -37,9 +37,9 @@ domain: version.reify, version: version.previous :coffee - $(document).on 'click', '.js-pending-toggle, .js-event', (e) -> + $(document).on 'click', '.js-pending, .js-event', (e) -> e.preventDefault() - $(document).on 'mousedown', '.js-pending-toggle, .js-event', (e) -> + $(document).on 'mousedown', '.js-pending, .js-event', (e) -> target = $(e.target) - target.parents('tr').next('tr.js-pending, tr.js-event').toggle() + target.parents('tr').nextUntil('tr.small' ,'tr.' + this.className).toggle() From 59f21221f5c1d120ecfa7a74962b88860a997370 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 16 May 2016 12:32:47 +0300 Subject: [PATCH 165/247] 117690107-request_trim --- app/controllers/epp_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index de1002604..3948a0645 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -362,6 +362,7 @@ class EppController < ApplicationController frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]]+)>([^<])+<\/eis:legalDocument>/, "[FILTERED]") if frame.present? + trimmed_request.gsub(/\s+\s+/, ">") ApiLog::EppLog.create({ request: trimmed_request, From c41266ce8d8cd6e49a40c096be5c0c6d02bd4414 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 16 May 2016 18:07:12 +0300 Subject: [PATCH 166/247] 118827261-wrong_msg_deleted --- app/views/epp/poll/poll_req.xml.builder | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/epp/poll/poll_req.xml.builder b/app/views/epp/poll/poll_req.xml.builder index 605ca496e..e8275dc95 100644 --- a/app/views/epp/poll/poll_req.xml.builder +++ b/app/views/epp/poll/poll_req.xml.builder @@ -13,8 +13,6 @@ xml.epp_head do case @message.attached_obj_type when 'DomainTransfer' xml << render('epp/domains/partials/transfer', builder: xml, dt: @object) - when 'DomainVersion' - xml << render('epp/domains/partials/delete_complete', builder: xml, bye_bye: @object) end end if @object From 01f8aa1e68671109ca1fe793d627cb4b38a8cdfc Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 18 May 2016 18:18:08 +0300 Subject: [PATCH 167/247] 116209751-updated_gem_ref --- Gemfile | 4 +--- Gemfile.lock | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index d9ad7593a..d990fa2cb 100644 --- a/Gemfile +++ b/Gemfile @@ -88,9 +88,7 @@ gem 'digidoc_client', '0.2.1' # epp gem 'epp', '1.4.2', github: 'internetee/epp' -gem 'epp-xml', '1.0.4', - github: 'internetee/epp-xml', - ref: '009611d78a3bebab33c04f73968f4606863f4b93' # EIS EPP XMLs +gem 'epp-xml', '1.0.5', github: 'internetee/epp-xml' # EIS EPP XMLs gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem) # que diff --git a/Gemfile.lock b/Gemfile.lock index c4ace1088..577bbbf20 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,10 +18,9 @@ GIT GIT remote: https://github.com/internetee/epp-xml.git - revision: 009611d78a3bebab33c04f73968f4606863f4b93 - ref: 009611d78a3bebab33c04f73968f4606863f4b93 + revision: 475f650951f2cf5015e00d48f408a2194ecc1662 specs: - epp-xml (1.0.4) + epp-xml (1.0.5) activesupport (~> 4.1) builder (~> 3.2) @@ -595,7 +594,7 @@ DEPENDENCIES devise (= 3.5.4) digidoc_client (= 0.2.1) epp (= 1.4.2)! - epp-xml (= 1.0.4)! + epp-xml (= 1.0.5)! fabrication (= 2.13.2) faker (= 1.4.3) figaro (= 1.1.1) From b18021774d690e327b32fd12c5e2f95dd6329d8f Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 19 May 2016 13:35:01 +0300 Subject: [PATCH 168/247] 114677695-reg_exp_and_length_change --- app/models/nameserver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 1dbb02d19..729ac6cbf 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -8,7 +8,7 @@ class Nameserver < ActiveRecord::Base # scope :owned_by_registrar, -> (registrar) { joins(:domain).where('domains.registrar_id = ?', registrar.id) } # rubocop: disable Metrics/LineLength - validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõÄÖÜÕ0-9][a-zA-ZäöüõÄÖÜÕ0-9\-]*[a-zA-ZäöüõÄÖÜÕ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } + validates :hostname, length: { maximum: 63 }, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } # validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true } # validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } validate :val_ipv4 From 92c7469372aa8e9b42761a6b530280d415bc7629 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 19 May 2016 18:06:27 +0300 Subject: [PATCH 169/247] 117690170-request_trim --- app/controllers/epp_controller.rb | 1 - lib/epp_constraint.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 3948a0645..de1002604 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -362,7 +362,6 @@ class EppController < ApplicationController frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]]+)>([^<])+<\/eis:legalDocument>/, "[FILTERED]") if frame.present? - trimmed_request.gsub(/\s+\s+/, ">") ApiLog::EppLog.create({ request: trimmed_request, diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 06cf3d45a..71c0e2fb2 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,6 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/\s<\//, "\s/, ">") request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! From 12ada2af79eda0e811cd251e473e931d18614d6b Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 19 May 2016 18:13:22 +0300 Subject: [PATCH 170/247] 118827161-emty_block_remove --- app/views/epp/poll/poll_req.xml.builder | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/views/epp/poll/poll_req.xml.builder b/app/views/epp/poll/poll_req.xml.builder index e8275dc95..d5da707a6 100644 --- a/app/views/epp/poll/poll_req.xml.builder +++ b/app/views/epp/poll/poll_req.xml.builder @@ -9,13 +9,11 @@ xml.epp_head do xml.msg @message.body end - xml.resData do - case @message.attached_obj_type - when 'DomainTransfer' - xml << render('epp/domains/partials/transfer', builder: xml, dt: @object) - end - end if @object - + if @message.attached_obj_type == 'DomainTransfer' + xml.resData do + xml << render('epp/domains/partials/transfer', builder: xml, dt: @object) + end if @object + end render('epp/shared/trID', builder: xml) end end From 50fe0fa462921a788027ab5258c5c434d7d2ce28 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 20 May 2016 14:01:12 +0300 Subject: [PATCH 171/247] 117690107-trim_logic_change --- lib/epp_constraint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 71c0e2fb2..9cd68c121 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,7 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean - request.params[:raw_frame] = request.params[:raw_frame].gsub!(/\s<\//, "\s/, ">") + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! From 866f44815dae1ae1156baf87721d460f99211756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Fri, 20 May 2016 15:14:19 +0300 Subject: [PATCH 172/247] Update CHANGELOG.md --- CHANGELOG.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68391b057..ce74bbb10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +20.05.2016 + +* Portal for registrars + * domain details view new displays contact name in addition to ID (#117226457) + * added an option to set veryfied = "yes" parameter to GUI for registrant change and domain delete opertions (#116209751) +* Admin interface + * BUG: fixed number of sorting issues on different views (#117350717) + * BUG: internal error on filtered list sorting (#115043065) + * BUG: account activities csv export messes up registrars (#117702653) + * usability fixes to history view (#115762063) +* Registry + * epp-xml gem reference updated to v 1.0.5 (#116209751) + * epp-xml gem is now taken from local repo https://github.com/internetee/epp-xml/blob/master, the version in RubyGems is not updated any more (#116209751) + * BUG: domains set to force delete were deleted a day ahead of time (#117131083) + * BUG: QUE - undefined method `code' for nil:NilClass - if contact is removed before Que gets to it (#117612061) + * BUG: Que - uninitialized constant RegenerateWhoisRecordJob (#117986917) +* EPP + * BUG: poll message on domain delete does not validate against .ee xml schemas (#118827261) + * BUG: internal error on domain delete (#118159567) +* RestWHOIS + * BUG: statuses not in array for not registered reserved and blocked domains (#118911315) + +... + 21.09.2015 * eis-1.0.xsd schema file updated without a new version, please publish a new updated schema file to public. From a51f536781f58df0e53a057951752f0bb0429704 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 15:32:06 +0300 Subject: [PATCH 173/247] Story#118912395 - rearrange before_action for more readability --- app/controllers/epp_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index de1002604..57a5f34d4 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -6,8 +6,14 @@ class EppController < ApplicationController before_action :generate_svtrid before_action :latin_only - before_action :validate_against_schema + before_action :validate_request + before_action :update_epp_session + + around_action :catch_epp_errors + + helper_method :current_user + def validate_against_schema return if ['hello', 'error', 'keyrelay'].include?(params[:action]) schema.validate(params[:nokogiri_frame]).each do |error| @@ -20,10 +26,7 @@ class EppController < ApplicationController handle_errors and return if epp_errors.any? end - before_action :validate_request - before_action :update_epp_session - around_action :catch_epp_errors def catch_epp_errors err = catch(:epp_error) do yield @@ -34,7 +37,6 @@ class EppController < ApplicationController handle_errors end - helper_method :current_user rescue_from StandardError do |e| @errors ||= [] From 0a0b9c323b6550fc7c42767f12819a49a5361d67 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 15:40:10 +0300 Subject: [PATCH 174/247] Story#115762063 - update which children elements should be saved in logs --- app/models/domain.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 7d383f6c9..5959cbb90 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -739,9 +739,10 @@ class Domain < ActiveRecord::Base log[:admin_contacts] = admin_contact_ids log[:tech_contacts] = tech_contact_ids log[:nameservers] = nameserver_ids + log[:dnskeys] = dnskey_ids + log[:domain_statuses]= domain_status_ids log[:legal_documents]= [legal_document_id] log[:registrant] = [registrant_id] - log[:domain_statuses] = domain_status_ids log end From 36a854ab4c02d46d8c8dc5dde4ba2b6894356320 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 20 May 2016 16:30:33 +0300 Subject: [PATCH 175/247] =?UTF-8?q?11=D1=91601356-error=5Fmap=5Fupd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/epp/contact.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index df2dabf78..f6bf54f74 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -126,6 +126,7 @@ class Epp::Contact < Contact [:ident, :invalid_birthday_format], [:ident, :invalid_country_code], [:ident_type, :missing], + [:ident_type, :invalid], [:code, :invalid], [:code, :too_long_contact_code] ], From 714dd1473d58e4ba0239603d9e9ad0428a08b194 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 16:37:38 +0300 Subject: [PATCH 176/247] Story#118912395 - EppLog saves resource --- app/controllers/epp/keyrelays_controller.rb | 4 ++++ app/controllers/epp/polls_controller.rb | 4 ++++ app/controllers/epp/sessions_controller.rb | 5 +++++ app/controllers/epp_controller.rb | 8 +++++++- config/routes.rb | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp/keyrelays_controller.rb b/app/controllers/epp/keyrelays_controller.rb index d6515758f..81ff3dd32 100644 --- a/app/controllers/epp/keyrelays_controller.rb +++ b/app/controllers/epp/keyrelays_controller.rb @@ -56,4 +56,8 @@ class Epp::KeyrelaysController < EppController # domain end + + def resource + @domain + end end diff --git a/app/controllers/epp/polls_controller.rb b/app/controllers/epp/polls_controller.rb index 531509a6c..fb032975f 100644 --- a/app/controllers/epp/polls_controller.rb +++ b/app/controllers/epp/polls_controller.rb @@ -54,4 +54,8 @@ class Epp::PollsController < EppController def validate_poll requires_attribute 'poll', 'op', values: %(ack req), allow_blank: true end + + def resource + @message + end end diff --git a/app/controllers/epp/sessions_controller.rb b/app/controllers/epp/sessions_controller.rb index c217d38aa..58a314410 100644 --- a/app/controllers/epp/sessions_controller.rb +++ b/app/controllers/epp/sessions_controller.rb @@ -137,4 +137,9 @@ class Epp::SessionsController < EppController pw = params[:parsed_frame].css('pw').first.text { username: user, password: pw } end + + private + def resource + @api_user + end end diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 57a5f34d4..e7d3f0ac1 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -13,6 +13,7 @@ class EppController < ApplicationController around_action :catch_epp_errors helper_method :current_user + helper_method :resource def validate_against_schema return if ['hello', 'error', 'keyrelay'].include?(params[:action]) @@ -369,7 +370,7 @@ class EppController < ApplicationController request: trimmed_request, request_command: request_command, request_successful: epp_errors.empty?, - request_object: params[:epp_object_type], + request_object: resource ? "#{params[:epp_object_type]}: #{resource.class} - #{resource.id} - #{resource.name}" : params[:epp_object_type], response: @response, api_user_name: @api_user.try(:username) || current_user.try(:username) || 'api-public', api_user_registrar: @api_user.try(:registrar).try(:to_s) || current_user.try(:registrar).try(:to_s), @@ -385,4 +386,9 @@ class EppController < ApplicationController return if current_user.blank? counter_update(current_user.registrar_code, ENV['iptables_server_ip']) end + + def resource + name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize + instance_variable_get("@#{name}") + end end diff --git a/config/routes.rb b/config/routes.rb index a041e41b7..39d6b3937 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,7 @@ Rails.application.routes.draw do post 'command/:action', controller: 'domains', constraints: EppConstraint.new(:domain) post 'command/:action', controller: 'contacts', constraints: EppConstraint.new(:contact) - post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll) + post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll) post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay) post 'command/:command', to: 'errors#not_found', constraints: EppConstraint.new(:not_found) # fallback route From af9fc5b4fa68819755a13ac1676159b2864d9ae1 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 20 May 2016 16:58:39 +0300 Subject: [PATCH 177/247] Story#118912395 - add method name to objects which are assigned to EPP logger --- app/models/api_user.rb | 4 ++++ app/models/message.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/models/api_user.rb b/app/models/api_user.rb index 260441620..5d6e3afb7 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -62,6 +62,10 @@ class ApiUser < User username end + def name + username + end + def queued_messages registrar.messages.queued end diff --git a/app/models/message.rb b/app/models/message.rb index 174edc8ef..10d823e63 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -12,4 +12,8 @@ class Message < ActiveRecord::Base self.queued = false save end + + def name + "-" + end end From 44c665e8a096f41f9af5f15070d1408c37658960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 24 May 2016 11:49:06 +0300 Subject: [PATCH 178/247] Improved notification on login screen of portal for registrants. --- config/locales/devise.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index e419f7794..0b1bacb95 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -14,7 +14,7 @@ en: last_attempt: "You have one more attempt before your account is locked." not_found_in_database: "Invalid email address or password." timeout: "Your session expired. Please sign in again to continue." - unauthenticated: "You need to sign in or sign up before continuing." + unauthenticated: "You need to sign in. Currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID." unconfirmed: "You have to confirm your email address before continuing." mailer: confirmation_instructions: From 80a5c9d054feb1a5332bb56614b9e10f7ff68746 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 24 May 2016 14:00:43 +0300 Subject: [PATCH 179/247] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 16f8a300e..74382f63a 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -29,7 +29,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event = 'create') && (version && version.uuid) + - if (event == 'update' || event == 'create') && (version && version.uuid) = link_to event, '#', class: 'js-event' - else = event From fa2231b27e30129f4719d5a1e4dabe0a7b857341 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 24 May 2016 16:34:26 +0300 Subject: [PATCH 180/247] 114677695-additional_validation_rule --- app/models/nameserver.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 729ac6cbf..00a06c95f 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -16,6 +16,7 @@ class Nameserver < ActiveRecord::Base # rubocop: enable Metrics/LineLength before_validation :normalize_attributes + before_validation :check_puny_symbols delegate :name, to: :domain, prefix: true @@ -41,6 +42,11 @@ class Nameserver < ActiveRecord::Base self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase) end + def check_puny_symbols + regexp = /(\A|\.)..--/ + errors.add(:hostname, :invalid) if hostname =~ regexp + end + def to_s hostname end From 7d1decbc87f1614664e1cf78e1271186174b21cb Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 24 May 2016 17:25:16 +0300 Subject: [PATCH 181/247] 111601356-extra_msg --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index d6d5369dd..edc7bedd3 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -33,7 +33,7 @@ class Contact < ActiveRecord::Base uniqueness: { message: :epp_id_taken }, format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } - validates :ident_type, inclusion: {in: %w( org priv birthday)} + validates :ident_type, inclusion: {in: %w( org priv birthday), message: :invalid} validate :val_ident_valid_format? validate :uniq_statuses? validate :validate_html From 9485c196882fa46fdb7d9b3fd37d30eeefa48b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 25 May 2016 08:31:07 +0300 Subject: [PATCH 182/247] Removed registrant specific part as unauthorized variable is used in other interfaces as well. --- config/locales/devise.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 0b1bacb95..9524e860c 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -14,7 +14,7 @@ en: last_attempt: "You have one more attempt before your account is locked." not_found_in_database: "Invalid email address or password." timeout: "Your session expired. Please sign in again to continue." - unauthenticated: "You need to sign in. Currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID." + unauthenticated: "You need to sign in." unconfirmed: "You have to confirm your email address before continuing." mailer: confirmation_instructions: From 3adbd0a00e83bd21ce1ef54842fa4accc0277af6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 10:13:10 +0300 Subject: [PATCH 183/247] Story#120259603 - git uses right branch last commit message --- config/deploy-example.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy-example.rb b/config/deploy-example.rb index 33bf49247..536775727 100644 --- a/config/deploy-example.rb +++ b/config/deploy-example.rb @@ -235,7 +235,7 @@ end desc 'Loads current commit hash' task load_commit_hash: :environment do queue! %( - echo "CURRENT_COMMIT_HASH = '$(git --git-dir #{deploy_to}/scm rev-parse --short HEAD)'" > \ + echo "CURRENT_COMMIT_HASH = '$(git --git-dir #{deploy_to}/scm rev-parse --short #{branch})'" > \ #{deploy_to}/shared/config/initializers/current_commit_hash.rb ) end From 4b9ba0fe13d5afdfe19e4ae77a1c66d02add0ea7 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 11:09:06 +0300 Subject: [PATCH 184/247] Story#108869472 - contact history uses same pagination what domain history does --- .../admin/contact_versions_controller.rb | 17 +++++++++++++---- app/views/admin/contact_versions/show.haml | 16 +++++----------- app/views/admin/domain_versions/show.haml | 14 ++++---------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index 9c8d05e61..cf7648720 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -29,10 +29,19 @@ class Admin::ContactVersionsController < AdminController def show per_page = 7 - @version = ContactVersion.find(params[:id]) - @q = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc).search - @versions = @q.result.page(params[:page]) - @versions = @versions.per(per_page) + @version = ContactVersion.find(params[:id]) + @versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc) + + # what we do is calc amount of results until needed version + # then we cacl which page it is + if params[:page].blank? + counter = @versions.where("created_at > ?", @version.created_at).count + page = counter / per_page + page += 1 if (counter % per_page) != 0 + params[:page] = page + end + + @versions = @versions.page(params[:page]).per(per_page) end def search diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index d48f22be6..6bfe88ecc 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -92,15 +92,9 @@ .panel.panel-default{:style => "min-height:420px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| - - if vs.id == @version.id - %li.active - = link_to admin_contact_version_path(vs.id) do - = l(vs.created_at, format: :short) - = vs.event - - else - %li - = link_to admin_contact_version_path(vs.id) do - = l(vs.created_at, format: :short) - = vs.event + %li{class: (vs.id == @version.id) && :active} + = link_to admin_contact_version_path(vs.id, page: params[:page]) do + = l(vs.created_at, format: :short) + = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} - = paginate @versions \ No newline at end of file + = paginate @versions, theme: :admin \ No newline at end of file diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 2a245ab1f..999714ad3 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -96,15 +96,9 @@ .panel.panel-default{:style => "min-height:450px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| - - if vs.id == @version.id - %li.active - = link_to admin_domain_version_path(vs) do - = l(vs.created_at, format: :short) - = vs.event - - else - %li - = link_to admin_domain_version_path(vs) do - = l(vs.created_at, format: :short) - = vs.event + %li{class: (vs.id == @version.id) && :active} + = link_to admin_domain_version_path(vs) do + = l(vs.created_at, format: :short) + = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} = paginate @versions, theme: :admin From a1dc8043ec16f26a4af2c16400ce501f0811eeb5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 11:20:45 +0300 Subject: [PATCH 185/247] Story#120259603 - sort versions by id as otherwise postgresql becomes crazy on offset --- app/controllers/admin/contact_versions_controller.rb | 4 ++-- app/controllers/admin/domain_versions_controller.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index cf7648720..e318c0e9c 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -30,12 +30,12 @@ class Admin::ContactVersionsController < AdminController def show per_page = 7 @version = ContactVersion.find(params[:id]) - @versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc) + @versions = ContactVersion.where(item_id: @version.item_id).order(id: :desc) # what we do is calc amount of results until needed version # then we cacl which page it is if params[:page].blank? - counter = @versions.where("created_at > ?", @version.created_at).count + counter = @versions.where("id > ?", @version.id).count page = counter / per_page page += 1 if (counter % per_page) != 0 params[:page] = page diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 1a469ddeb..debf628cf 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -44,12 +44,12 @@ class Admin::DomainVersionsController < AdminController def show per_page = 7 @version = DomainVersion.find(params[:id]) - @versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc) + @versions = DomainVersion.where(item_id: @version.item_id).order(id: :desc) # what we do is calc amount of results until needed version # then we cacl which page it is if params[:page].blank? - counter = @versions.where("created_at > ?", @version.created_at).count + counter = @versions.where("id > ?", @version.id).count page = counter / per_page page += 1 if (counter % per_page) != 0 params[:page] = page From c0a6737f1f417413efc129e531c9ca115f6447d8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 12:07:02 +0300 Subject: [PATCH 186/247] Story#120259603 - remove phone number and rename column name in contact history --- app/views/admin/contact_versions/index.haml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/views/admin/contact_versions/index.haml b/app/views/admin/contact_versions/index.haml index 0e513f37b..93699d4e3 100644 --- a/app/views/admin/contact_versions/index.haml +++ b/app/views/admin/contact_versions/index.haml @@ -16,16 +16,13 @@ .form-group = f.label :ident = f.search_field :ident, value: params[:q][:ident], class: 'form-control', placeholder: t(:ident) - .col-md-3 - .form-group - = f.label :phone - = f.search_field :phone, value: params[:q][:phone], class: 'form-control', placeholder: t(:phone) - .row - .col-md-3 .col-md-3 .form-group = label_tag :action = select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy'], ['Create', 'create']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' } + .row + .col-md-3 + .col-md-3 .col-md-3 .form-group = label_tag t(:results_per_page) @@ -52,14 +49,12 @@ = t(:id) %th{class: 'col-xs-2'} = t(:ident) - %th{class: 'col-xs-2'} - = t(:phone) %th{class: 'col-xs-2'} = t(:registrar) - %th{class: 'col-xs-2'} - = t(:action_date) %th{class: 'col-xs-2'} = t(:action) + %th{class: 'col-xs-2'} + = t(:created_at) %tbody - @versions.each do |version| - if version @@ -70,12 +65,11 @@ %td= link_to(contact.name, admin_contact_version_path(version.id)) %td= contact.code %td= ident_for(contact) - %td= contact.phone %td - if contact.registrar = link_to(contact.registrar, admin_registrar_path(contact.registrar)) - %td= l(version.created_at, format: :short) %td= version.event + %td= l(version.created_at, format: :short) .row From 51bdd72f465a079294bcd5f086ede77f2bd7f884 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 12:31:53 +0300 Subject: [PATCH 187/247] Story#120259603 - remove registrered_at from pure domain history --- app/views/admin/domain_versions/show.haml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index 999714ad3..c00200b88 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -24,9 +24,6 @@ %dl.dl-horizontal %dt= t(:name) %dd= link_to(domain.name, admin_domain_path(@version.item_id)) - %dt= t(:registered_at) - %dd - = l(domain.registered_at, format: :short) %dt= t(:created) %dd From 7a27756a36d41a625420867732487e7382cf9398 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 25 May 2016 12:42:10 +0300 Subject: [PATCH 188/247] 111601356-errors_customization --- app/models/contact.rb | 2 +- app/models/epp/contact.rb | 4 +++- config/locales/en.yml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index edc7bedd3..bdf0a6017 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -33,7 +33,7 @@ class Contact < ActiveRecord::Base uniqueness: { message: :epp_id_taken }, format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } - validates :ident_type, inclusion: {in: %w( org priv birthday), message: :invalid} + validates :ident_type, inclusion: {in: %w( org priv birthday), message: :ident_type_invalid} validate :val_ident_valid_format? validate :uniq_statuses? validate :validate_html diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index f6bf54f74..af3cc13a9 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -126,13 +126,15 @@ class Epp::Contact < Contact [:ident, :invalid_birthday_format], [:ident, :invalid_country_code], [:ident_type, :missing], - [:ident_type, :invalid], [:code, :invalid], [:code, :too_long_contact_code] ], '2302' => [ # Object exists [:code, :epp_id_taken] ], + '2304' => [ + [:ident_type, :invalid, { value: { obj: 'ident_type', val: ident_type } }] + ], '2305' => [ # Association exists [:domains, :exist] ], diff --git a/config/locales/en.yml b/config/locales/en.yml index de5891c77..ea05adec3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -266,6 +266,7 @@ en: unimplemented_command: 'Unimplemented command' domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar' required_ident_attribute_missing: "Required ident attribute missing: %{key}" + ident_type_invalid: 'Ident type is invalid' code: 'Code' value: 'Value' From e9a8cf086babda2a2f1a2703e9ea93a95ecb5b0f Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 12:45:20 +0300 Subject: [PATCH 189/247] Story#120259603 - versions search is case insensitive --- app/controllers/admin/contact_versions_controller.rb | 2 +- app/controllers/admin/domain_versions_controller.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index e318c0e9c..dca7f8e7d 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -49,7 +49,7 @@ class Admin::ContactVersionsController < AdminController end def create_where_string(key, value) - " AND object->>'#{key}' LIKE '%#{value}%'" + " AND object->>'#{key}' ILIKE '%#{value}%'" end end diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index debf628cf..32fe3885d 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -9,12 +9,12 @@ class Admin::DomainVersionsController < AdminController search_params = params[:q].deep_dup if search_params[:registrant].present? - registrants = Contact.where("name like ?", "%#{search_params[:registrant].strip}%") + registrants = Contact.where("name ilike ?", "%#{search_params[:registrant].strip}%") search_params.delete(:registrant) end if search_params[:registrar].present? - registrars = Registrar.where("name like ?", "%#{search_params[:registrar].strip}%") + registrars = Registrar.where("name ilike ?", "%#{search_params[:registrar].strip}%") search_params.delete(:registrar) end @@ -63,7 +63,7 @@ class Admin::DomainVersionsController < AdminController end def create_where_string(key, value) - " AND object->>'#{key}' ~ '#{value}'" + " AND object->>'#{key}' ~* '#{value}'" end From 1daafb30bac78487263c486828a2e1ff46b896fc Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 13:13:47 +0300 Subject: [PATCH 190/247] Story#118300251 - domain history by loaded version may reference to deleted contact --- app/controllers/admin_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 29b7be698..309007331 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,9 +1,13 @@ class AdminController < ApplicationController layout 'admin/application' - before_action :authenticate_user! + # before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end + + def current_user + @current_user ||= AdminUser.find_by(username: :timo) + end end From e15aa6ada4cd7a6fae02826d174bbbc5241e2bec Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 13:14:41 +0300 Subject: [PATCH 191/247] Story#120259603 - git uses right branch last commit message --- app/controllers/admin_controller.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 309007331..29b7be698 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,13 +1,9 @@ class AdminController < ApplicationController layout 'admin/application' - # before_action :authenticate_user! + before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end - - def current_user - @current_user ||= AdminUser.find_by(username: :timo) - end end From bb0b74aa3955babe8bf2f6eae8bdeb100e812f26 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 25 May 2016 13:14:54 +0300 Subject: [PATCH 192/247] Story#120259603 - git uses right branch last commit message --- app/views/admin/domains/partials/_version.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 7cd9a497e..e0281ac71 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -18,7 +18,7 @@ - dnskeys = domain.dnskeys - tech_contacts = domain.tech_contacts - admin_contacts = domain.admin_contacts - - registrant = [domain.registrant] + - registrant = [domain.registrant ? domain.registrant : ContactVersion.where(item_id: domain.registrant_id).where(event: :destroy).last.reify] - creator = pending_user.try(:username) - event = 'pending' From 960eceb1f2feefc955b877225b25edc96cb1a743 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 25 May 2016 13:21:35 +0300 Subject: [PATCH 193/247] 114677695-label_length_validation_changes --- app/models/nameserver.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 00a06c95f..4b6ef3df5 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -8,7 +8,7 @@ class Nameserver < ActiveRecord::Base # scope :owned_by_registrar, -> (registrar) { joins(:domain).where('domains.registrar_id = ?', registrar.id) } # rubocop: disable Metrics/LineLength - validates :hostname, length: { maximum: 63 }, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } + validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ } # validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true } # validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } validate :val_ipv4 @@ -17,6 +17,7 @@ class Nameserver < ActiveRecord::Base before_validation :normalize_attributes before_validation :check_puny_symbols + before_validation :check_label_length delegate :name, to: :domain, prefix: true @@ -42,6 +43,12 @@ class Nameserver < ActiveRecord::Base self.ipv6 = Array(ipv6).reject(&:blank?).map(&:strip).map(&:upcase) end + def check_label_length + hostname.split('.').each do |label| + errors.add(:hostname, :invalid) if label.length > 63 + end + end + def check_puny_symbols regexp = /(\A|\.)..--/ errors.add(:hostname, :invalid) if hostname =~ regexp From 9e3bb02dd169b6e42362d935070c823df8607856 Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 25 May 2016 17:19:50 +0300 Subject: [PATCH 194/247] 111601356-error_text_modification --- app/models/epp/contact.rb | 4 ++-- config/locales/en.yml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index af3cc13a9..8e1da8e4b 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -132,8 +132,8 @@ class Epp::Contact < Contact '2302' => [ # Object exists [:code, :epp_id_taken] ], - '2304' => [ - [:ident_type, :invalid, { value: { obj: 'ident_type', val: ident_type } }] + '2304' => [ # Object status prohibits operation + [:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code } }] ], '2305' => [ # Association exists [:domains, :exist] diff --git a/config/locales/en.yml b/config/locales/en.yml index ea05adec3..4e915de6a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -52,6 +52,9 @@ en: invalid_EE_identity_format_update: "Ident not in valid Estonian identity format. Please create new contact" invalid_birthday_format: "Ident not in valid birthady format, should be YYYY-MM-DD" invalid_country_code: "Ident country code is not valid, should be in ISO_3166-1 alpha 2 format" + ident_type: + ident_type_invalid: 'Ident type is invalid' + epp_ident_type_invalid: 'Object status prohibits operation: ident_type of contact %{code} is invalid' domains: exist: 'Object association prohibits operation' statuses: @@ -266,7 +269,6 @@ en: unimplemented_command: 'Unimplemented command' domain_exists_but_belongs_to_other_registrar: 'Domain exists but belongs to other registrar' required_ident_attribute_missing: "Required ident attribute missing: %{key}" - ident_type_invalid: 'Ident type is invalid' code: 'Code' value: 'Value' From 9cb3869bcbdbc8c8ac0cab4e60fc50669fce6f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 26 May 2016 14:10:26 +0300 Subject: [PATCH 195/247] Updated automated email notification messages. --- .../contact_mailer/email_updated.html.erb | 6 ++-- .../contact_mailer/email_updated.text.erb | 6 ++-- .../delete_confirmation.html.erb | 6 ++-- .../delete_confirmation.text.erb | 6 ++-- .../expiration_reminder.html.erb | 31 +++++-------------- .../expiration_reminder.text.erb | 21 ++----------- .../domain_mailer/force_delete.html.erb | 18 +++++------ .../domain_mailer/force_delete.text.erb | 18 +++++------ ...nding_delete_expired_notification.html.erb | 6 ++-- ...nding_delete_expired_notification.text.erb | 6 ++-- ...ding_delete_rejected_notification.html.erb | 8 ++--- ...ding_delete_rejected_notification.text.erb | 8 ++--- .../domain_mailer/pending_deleted.html.erb | 12 +++---- .../domain_mailer/pending_deleted.text.erb | 12 +++---- ...d_notification_for_new_registrant.html.erb | 10 +++--- ...d_notification_for_new_registrant.text.erb | 10 +++--- ...e_notification_for_new_registrant.html.erb | 8 ++--- ...e_notification_for_new_registrant.text.erb | 8 ++--- ...d_notification_for_new_registrant.html.erb | 12 +++---- ...d_notification_for_new_registrant.text.erb | 11 ++++--- ...update_request_for_old_registrant.html.erb | 10 +++--- ...update_request_for_old_registrant.text.erb | 10 +++--- ...d_notification_for_new_registrant.html.erb | 4 +-- ...d_notification_for_new_registrant.text.erb | 4 +-- ...d_notification_for_old_registrant.html.erb | 4 +-- ...d_notification_for_old_registrant.text.erb | 4 +-- 26 files changed, 115 insertions(+), 144 deletions(-) diff --git a/app/views/mailers/contact_mailer/email_updated.html.erb b/app/views/mailers/contact_mailer/email_updated.html.erb index 2c5a265e9..6c88f5009 100644 --- a/app/views/mailers/contact_mailer/email_updated.html.erb +++ b/app/views/mailers/contact_mailer/email_updated.html.erb @@ -4,7 +4,7 @@ Kontakti <%= @contact.name %> e-posti aadress on muudetud
endine aadress: <%= @old_email %>
uus aadress: <%= @contact.email %>

-E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %> +E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @contact.registrar.name %> poole.

<% if @contact.related_domain_descriptions.present? %> Muudatusega seotud domeenid:
@@ -23,7 +23,7 @@ Linn: <%= @contact.city %>
Riik: <%= @contact.country %>

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




@@ -52,4 +52,4 @@ City: <%= @contact.city %>
Country: <%= @contact.country %>

Best Regards,
-Eesti Interneti SA +Estonian Internet Foundation diff --git a/app/views/mailers/contact_mailer/email_updated.text.erb b/app/views/mailers/contact_mailer/email_updated.text.erb index 835ea2ad6..56cb319bc 100644 --- a/app/views/mailers/contact_mailer/email_updated.text.erb +++ b/app/views/mailers/contact_mailer/email_updated.text.erb @@ -4,7 +4,7 @@ Kontakti <%= @contact.name %> e-posti aadress on muudetud endine aadress: <%= @old_email %> uus aadress: <%= @contact.email %> -E-posti aadressile saadetakse domeeni toimingutega seotud infot, seal hulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %> +E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @contact.registrar.name %> poole. <% if @contact.related_domain_descriptions.present? %> Muudatusega seotud domeenid: @@ -23,7 +23,7 @@ Linn: <%= @contact.city %> Riik: <%= @contact.country %> Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus ---------------------------------------------------------------------------------- @@ -52,4 +52,4 @@ City: <%= @contact.city %> Country: <%= @contact.country %> Best Regards, -Eesti Interneti SA +Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/delete_confirmation.html.erb b/app/views/mailers/domain_mailer/delete_confirmation.html.erb index acc915787..5a7cada60 100644 --- a/app/views/mailers/domain_mailer/delete_confirmation.html.erb +++ b/app/views/mailers/domain_mailer/delete_confirmation.html.erb @@ -1,15 +1,15 @@ -Tere, +Tere

Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist.

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




Hi,

-Domain <%= @domain.name %> deletion confirmed and will be deleted. +Domain <%= @domain.name %> deletion is confirmed by the registrant. Domain <%= @domain.name %> is suspended and will be deleted.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/delete_confirmation.text.erb b/app/views/mailers/domain_mailer/delete_confirmation.text.erb index a587b7f78..5d924eca7 100644 --- a/app/views/mailers/domain_mailer/delete_confirmation.text.erb +++ b/app/views/mailers/domain_mailer/delete_confirmation.text.erb @@ -1,15 +1,15 @@ -Tere, +Tere Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Domain <%= @domain.name %> deletion confirmed and will be deleted. +Domain <%= @domain.name %> deletion is confirmed by the registrant. Domain <%= @domain.name %> is suspended and will be deleted. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/expiration_reminder.html.erb b/app/views/mailers/domain_mailer/expiration_reminder.html.erb index e29ca826e..9404838ae 100644 --- a/app/views/mailers/domain_mailer/expiration_reminder.html.erb +++ b/app/views/mailers/domain_mailer/expiration_reminder.html.erb @@ -14,13 +14,8 @@ Registripidaja: <%= @domain.registrar.name %>
Nimeserverid: <%= @domain.nameservers.join(', ') %>
Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist. <%= ENV['registrant_url'] %>.


-Parimate soovidega -

-Eesti Interneti Sihtasutus
-Paldiski mnt 80, 10617 Tallinn
-Registrikood: 90010019
-E-post: info@internet.ee
-Tel: +372 727 1000
+Lugupidamisega
+Eesti Interneti Sihtasutus




@@ -29,7 +24,7 @@ Dear user of .ee domain,

The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :date) %>. From <%= l(@domain.delete_at, format: :date) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.

-To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://www.internet.ee/en/registripidajad/. +To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://internet.ee/registrars.

The following data for the <%= @domain.name %> domain have been entered into the registry:

@@ -40,13 +35,8 @@ Registrar: <%= @domain.registrar.name %>
Name servers: <%= @domain.nameservers.join(', ') %>
You can find an overview of all your domains at the registrant's portal. <%= ENV['registrant_url'] %>.


-Sincerely -

-Estonian Internet Foundation
-Paldiski mnt 80, 10617 Tallinn
-Business Registry no: 90010019
-E-mail: info@internet.ee
-Phone: +372 727 1000
+Best Regards,
+Estonian Internet Foundation




@@ -55,7 +45,7 @@ Phone: +372 727 1000

Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :date) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :date) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".

-Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://www.internet.ee/ru/p/. +Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://internet.ee/registratory.

Относительно домена <%= @domain.name %> в реестр внесены следующие данные:

@@ -66,10 +56,5 @@ Phone: +372 727 1000
Серверы доменных имен: <%= @domain.nameservers.join(', ') %>
Обзор всех связанных с Вами доменов можете получить на портале регистранта. <%= ENV['registrant_url'] %>.


-С наилучшими пожеланиями -

-Целевое учреждение Eesti Internet
-Paldiski mnt 80, 10617 Tallinn
-Регистрационный код: 90010019
-Э-почта: info@internet.ee
-Тел.: +372 727 1000
\ No newline at end of file +С наилучшими пожеланиями
+Целевое учреждение Eesti Internet diff --git a/app/views/mailers/domain_mailer/expiration_reminder.text.erb b/app/views/mailers/domain_mailer/expiration_reminder.text.erb index d16682ea5..5148df211 100644 --- a/app/views/mailers/domain_mailer/expiration_reminder.text.erb +++ b/app/views/mailers/domain_mailer/expiration_reminder.text.erb @@ -15,12 +15,7 @@ Nimeserverid: <%= @domain.nameservers.join(', ') %> Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist. <%= ENV['registrant_url'] %>. Parimate soovidega - Eesti Interneti Sihtasutus -Paldiski mnt 80, 10617 Tallinn -Registrikood: 90010019 -E-post: info@internet.ee -Tel: +372 727 1000 -------------------------------------- @@ -29,7 +24,7 @@ Dear user of .ee domain, The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= l(@domain.outzone_at, format: :date) %>. From <%= l(@domain.delete_at, format: :date) %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis. -To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://www.internet.ee/en/registripidajad/. +To renew the domain registration, please contact your registrar <%= @domain.registrar.name %>. You can find the registrar's contacts at http://internet.ee/registrars. The following data for the <%= @domain.name %> domain have been entered into the registry: @@ -40,13 +35,8 @@ Registrar: <%= @domain.registrar.name %> Name servers: <%= @domain.nameservers.join(', ') %> You can find an overview of all your domains at the registrant's portal. <%= ENV['registrant_url'] %>. -Sincerely - +Best Regards, Estonian Internet Foundation -Paldiski mnt 80, 10617 Tallinn -Business Registry no: 90010019 -E-mail: info@internet.ee -Phone: +372 727 1000 -------------------------------------- @@ -55,7 +45,7 @@ Phone: +372 727 1000 Доменное имя <%= @domain.name %> устарело и с <%= l(@domain.outzone_at, format: :date) %> недоступно в Интернете. С <%= l(@domain.delete_at, format: :date) %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served". -Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://www.internet.ee/ru/p/. +Для продления регистрации домена просим обратиться к своему регистратору <%= @domain.registrar.name %>. Контактные данные регистраторов можно найти по адресу http://internet.ee/registratory. Относительно домена <%= @domain.name %> в реестр внесены следующие данные: @@ -67,9 +57,4 @@ Phone: +372 727 1000 Обзор всех связанных с Вами доменов можете получить на портале регистранта. <%= ENV['registrant_url'] %>. С наилучшими пожеланиями - Целевое учреждение Eesti Internet -Paldiski mnt 80, 10617 Tallinn -Регистрационный код: 90010019 -Э-почта: info@internet.ee -Тел.: +372 727 1000 \ No newline at end of file diff --git a/app/views/mailers/domain_mailer/force_delete.html.erb b/app/views/mailers/domain_mailer/force_delete.html.erb index 6f4f4cb27..64fa3d2e2 100644 --- a/app/views/mailers/domain_mailer/force_delete.html.erb +++ b/app/views/mailers/domain_mailer/force_delete.html.erb @@ -9,33 +9,33 @@ Lugupeetud domeeni <%= @domain.name %> kontaktisik -

Eesti Interneti SA (EIS) domeeniregistrisse on domeeni <%= @domain.name %> kohta kantud järgmised andmed:

+

.ee domeeniregistrisse on domeeni <%= @domain.name %> kohta kantud järgmised andmed:

Registreerija nimi: <%= @domain.registrant %>
Registrikood: <%= @domain.registrant.try(:ident) %>

-

EIS-le on saanud teatavaks, et juriidiline isik registrikoodiga <%= @domain.registrant.try(:ident) %> on äriregistrist kustutatud.

+

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et juriidiline isik registrikoodiga <%= @domain.registrant.try(:ident) %> on äriregistrist kustutatud.

Kuivõrd äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, siis algatas EIS <%= l(Time.zone.now, format: :date) %> vastavalt Domeenireeglite (http://www.internet.ee/domeenid/) punktile 6.4 domeeni <%= @domain.name %> suhtes 30 päeva pikkuse kustutusmenetluse. Kustutamise käigus jääb domeen internetis kättesaadavaks.

-

Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes õigust omaval registreerijal võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @domain.registrar %> domeeni üleandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist tõendavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 sätestatud üleandva registreerija nõusolekut. Vastav dokumentatsioon tuleks esitada Registripidajale esimesel võimalusel.

+

Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes õigust omaval registreerijal võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @domain.registrar %> domeeni üleandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist tõendavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 sätestatud üleandva registreerija nõusolekut. Vastav dokumentatsioon tuleb esitada Registripidajale esimesel võimalusel.

Kui üleandmine ei ole 30 päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= l(@domain.force_delete_at, format: :date) %> möödumisest juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist “kes ees, see mees” põhimõttel uuesti registreerida.

-

Lisaküsimuste korral võtke palun ühendust oma registripidajaga <%= @domain.registrar %>, kelle kontaktandmed leiate lingilt http://www.internet.ee/registripidajad



+

Lisaküsimuste korral võtke palun ühendust oma registripidajaga <%= @domain.registrar %>. Registripidajate kontaktid leiate aadressilt http://www.internet.ee/registripidajad



Dear contact of <%= @domain.name %> domain -

The following details for domain name <%= @domain.name %> have been entered into the Estonian Internet Foundation's (EIF) domain registry:

+

The following details for domain name <%= @domain.name %> have been entered into the .ee domain registry:

Registrant's name: <%= @domain.registrant %>
Registry code: <%= @domain.registrant.try(:ident) %>

-

EIF has learned that the legal person with registry code <%= @domain.registrant.try(:ident) %> has been deleted from the Business Registry.

+

Estonian Internet Foundation (EIS) has learned that the legal person with registry code <%= @domain.registrant.try(:ident) %> has been deleted from the Business Registry.

-

As a terminated legal person cannot be the registrant of a domain, the EIF started the deletion process of <%= @domain.name %> domain on <%= l(Time.zone.now, format: :date) %> according to the Domain Regulation (http://www.internet.ee/domains/), using the 30-day delete procedure. The domain will remain available on the Internet during the delete procedure.

+

As a terminated legal person cannot be the registrant of a domain, the EIS started the deletion process of <%= @domain.name %> domain on <%= l(Time.zone.now, format: :date) %> according to the Domain Regulation (http://www.internet.ee/domains/), using the 30-day delete procedure. The domain will remain available on the Internet during the delete procedure.

According to paragraph 6.4 of the Domain Regulation, the registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @domain.registrar %> in accordance with paragraph 5.3.6.2 of the Domain Regulation. The application must be submitted together with documents certifying the acquisition of the domain that will replace the consent of the surrendering registrant as laid down in paragraph 5.3.6.3 of the Domain Regulation. The relevant documents should be submitted to the registrar as soon as possible.

@@ -65,9 +65,9 @@ Registry code: <%= @domain.registrant.try(:ident) %>

diff --git a/app/views/mailers/domain_mailer/force_delete.text.erb b/app/views/mailers/domain_mailer/force_delete.text.erb index d6369c8cb..f82cad6d2 100644 --- a/app/views/mailers/domain_mailer/force_delete.text.erb +++ b/app/views/mailers/domain_mailer/force_delete.text.erb @@ -1,32 +1,32 @@ Lugupeetud domeeni <%= @domain.name %> kontaktisik -Eesti Interneti SA (EIS) domeeniregistrisse on domeeni <%= @domain.name %> kohta kantud järgmised andmed: +.ee domeeniregistrisse on domeeni <%= @domain.name %> kohta kantud järgmised andmed: Registreerija nimi: <%= @domain.registrant %> Registrikood: <%= @domain.registrant.try(:ident) %> -EIS-le on saanud teatavaks, et juriidiline isik registrikoodiga <%= @domain.registrant.try(:ident) %> on äriregistrist kustutatud. +Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et juriidiline isik registrikoodiga <%= @domain.registrant.try(:ident) %> on äriregistrist kustutatud. Kuivõrd äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, siis algatas EIS <%= l(Time.zone.now, format: :date) %> vastavalt Domeenireeglite (http://www.internet.ee/domeenid/) punktile 6.4 domeeni <%= @domain.name %> suhtes 30 päeva pikkuse kustutusmenetluse. Kustutamise käigus jääb domeen internetis kättesaadavaks. -Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes õigust omaval registreerijal võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @domain.registrar %> domeeni üleandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist tõendavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 sätestatud üleandva registreerija nõusolekut. Vastav dokumentatsioon tuleks esitada Registripidajale esimesel võimalusel. +Domeenireeglite punktist 6.4 tulenevalt on domeeni suhtes õigust omaval registreerijal võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @domain.registrar %> domeeni üleandmise taotlus Domeenireeglite p 5.3.6.2 kohaselt. Taotlusele tuleb lisada domeeni omandamist tõendavad dokumendid, mis asendavad Domeenireeglite punktis 5.3.6.3 sätestatud üleandva registreerija nõusolekut. Vastav dokumentatsioon tuleb esitada Registripidajale esimesel võimalusel. Kui üleandmine ei ole 30 päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= l(@domain.force_delete_at, format: :date) %> möödumisest juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist "kes ees, see mees" põhimõttel uuesti registreerida. -Lisaküsimuste korral võtke palun ühendust oma registripidajaga <%= @domain.registrar %>, kelle kontaktandmed leiate lingilt http://www.internet.ee/registripidajad/ +Lisaküsimuste korral võtke palun ühendust oma registripidajaga <%= @domain.registrar %>. Registripidajate kontaktid leiate aadressilt http://www.internet.ee/registripidajad/ Dear contact of <%= @domain.name %> domain -The following details for domain name <%= @domain.name %> have been entered into the Estonian Internet Foundation's (EIF) domain registry: +The following details for domain name <%= @domain.name %> have been entered into the .ee domain registry: Registrant's name: <%= @domain.registrant %> Registry code: <%= @domain.registrant.try(:ident) %> -EIF has learned that the legal person with registry code <%= @domain.registrant.try(:ident) %> has been deleted from the Business Registry. +Estonian Internet Foundation (EIS) has learned that the legal person with registry code <%= @domain.registrant.try(:ident) %> has been deleted from the Business Registry. -As a terminated legal person cannot be the registrant of a domain, the EIF started the deletion process of <%= @domain.name %> domain on <%= l(Time.zone.now, format: :date) %> according to the Domain Regulation (http://www.internet.ee/domains/), using the 30-day delete procedure. The domain will remain available on the Internet during the delete procedure. +As a terminated legal person cannot be the registrant of a domain, the EIS started the deletion process of <%= @domain.name %> domain on <%= l(Time.zone.now, format: :date) %> according to the Domain Regulation (http://www.internet.ee/domains/), using the 30-day delete procedure. The domain will remain available on the Internet during the delete procedure. According to paragraph 6.4 of the Domain Regulation, the registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @domain.registrar %> in accordance with paragraph 5.3.6.2 of the Domain Regulation. The application must be submitted together with documents certifying the acquisition of the domain that will replace the consent of the surrendering registrant as laid down in paragraph 5.3.6.3 of the Domain Regulation. The relevant documents should be submitted to the registrar as soon as possible. @@ -56,8 +56,8 @@ EIS стало известно, что юридическое лицо с ре Lugupidamisega, -Yours Sincerely, +Best Regards, С уважением, --- -Eesti Interneti SA +Eesti Interneti Sihtasutus Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_delete_expired_notification.html.erb b/app/views/mailers/domain_mailer/pending_delete_expired_notification.html.erb index c5ed71c39..ae3dea358 100644 --- a/app/views/mailers/domain_mailer/pending_delete_expired_notification.html.erb +++ b/app/views/mailers/domain_mailer/pending_delete_expired_notification.html.erb @@ -1,15 +1,15 @@ -Tere, +Tere

Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




Hi,

-Domain <%= @domain.name %> deletion cancelled. +Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant_name %>. Thus the deletion of domain <%= @domain.name %> is cancelled.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_delete_expired_notification.text.erb b/app/views/mailers/domain_mailer/pending_delete_expired_notification.text.erb index 5ff510820..efd6eb449 100644 --- a/app/views/mailers/domain_mailer/pending_delete_expired_notification.text.erb +++ b/app/views/mailers/domain_mailer/pending_delete_expired_notification.text.erb @@ -1,15 +1,15 @@ -Tere, +Tere Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Domain <%= @domain.name %> deletion cancelled. +Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant_name %>. Thus the deletion of domain <%= @domain.name %> is cancelled. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_delete_rejected_notification.html.erb b/app/views/mailers/domain_mailer/pending_delete_rejected_notification.html.erb index e89a02327..9f381b2c5 100644 --- a/app/views/mailers/domain_mailer/pending_delete_rejected_notification.html.erb +++ b/app/views/mailers/domain_mailer/pending_delete_rejected_notification.html.erb @@ -1,15 +1,15 @@ -Tere, +Tere

-Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud. +Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant_name %> poolt tagasi lükatud.

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




Hi,

-Domain <%= @domain.name %> deletion rejected. +Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant_name %>.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_delete_rejected_notification.text.erb b/app/views/mailers/domain_mailer/pending_delete_rejected_notification.text.erb index d3600a3c7..8d49983a1 100644 --- a/app/views/mailers/domain_mailer/pending_delete_rejected_notification.text.erb +++ b/app/views/mailers/domain_mailer/pending_delete_rejected_notification.text.erb @@ -1,15 +1,15 @@ -Tere, +Tere -Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrar_name %> poolt tagasi lükatud. +Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant_name %> poolt tagasi lükatud. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Domain <%= @domain.name %> deletion rejected. +Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant_name %>. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_deleted.html.erb b/app/views/mailers/domain_mailer/pending_deleted.html.erb index 972318ee4..6d0a47f57 100644 --- a/app/views/mailers/domain_mailer/pending_deleted.html.erb +++ b/app/views/mailers/domain_mailer/pending_deleted.html.erb @@ -1,25 +1,25 @@ -Tere, +Tere

-Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @domain.registrar_name %> +Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @domain.registrar_name %> poole.

-Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan: +Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan.

Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
<%= link_to @verification_url, @verification_url %>

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




Hi,

-Application for deletion of your domain <%= @domain.name %> has been filed. Please make sure that the application is correct. Incase of problems please turn to your registrar. Your registrar is <%= @domain.registrar_name %> +Application for deletion of your domain <%= @domain.name %> has been filed. Please make sure that the application is correct. Incase of problems please contact your registrar <%= @domain.registrar_name %>.

To confirm the update please visit this website, once again review the data and press approve:
<%= link_to @verification_url, @verification_url %>

-The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before. +The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automatically rejected if it is not approved nor rejected before.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_deleted.text.erb b/app/views/mailers/domain_mailer/pending_deleted.text.erb index 80e01945a..cc49cbbb0 100644 --- a/app/views/mailers/domain_mailer/pending_deleted.text.erb +++ b/app/views/mailers/domain_mailer/pending_deleted.text.erb @@ -1,25 +1,25 @@ -Tere, +Tere -Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @domain.registrar_name %> +Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @domain.registrar_name %> poole. -Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan: +Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan. Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka. <%= link_to @verification_url, @verification_url %> Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Application for deletion of your domain <%= @domain.name %> has been filed. Please make sure that the application is correct. Incase of problems please turn to your registrar. Your registrar is <%= @domain.registrar_name %> +Application for deletion of your domain <%= @domain.name %> has been filed. Please make sure that the application is correct. Incase of problems please contact your registrar <%= @domain.registrar_name %>. To confirm the update please visit this website, once again review the data and press approve: <%= link_to @verification_url, @verification_url %> -The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before. +The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automatically rejected if it is not approved nor rejected before. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.html.erb index cfa539736..800ff33e1 100644 --- a/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.html.erb @@ -1,19 +1,19 @@ -Tere, +Tere

Domeeni <%= @params[:name] %> registreerija <%= @params[:registrant_name] %> ei kinnitanud tähtaegselt registreerija vahetuse taotlust. Domeeni <%= @params[:name] %> registreerija vahetus on sellest tulenevalt tühistatud.

-Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral palun võtke ühendust oma registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad.

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




Hi,

-Domain registrant change has been expired for the domain <%= @params[:name] %>. +Domain registrant change request has been expired for the domain <%= @params[:name] %>.

-Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. You can find the registrar's contacts at http://internet.ee/registrars.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.text.erb index 626583562..88ddefe9d 100644 --- a/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_expired_notification_for_new_registrant.text.erb @@ -1,19 +1,19 @@ -Tere, +Tere Domeeni <%= @params[:name] %> registreerija <%= @params[:registrant_name] %> ei kinnitanud tähtaegselt registreerija vahetuse taotlust. Domeeni <%= @params[:name] %> registreerija vahetus on sellest tulenevalt tühistatud. -Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral palun võtke ühendust oma registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Domain registrant change has been expired for the domain <%= @params[:name] %>. +Domain registrant change request has been expired for the domain <%= @params[:name] %>. -Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. You can find the registrar's contacts at http://internet.ee/registrars. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb index cbf450d9d..853fbafd5 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb @@ -1,8 +1,8 @@ -Tere, +Tere

Registripidaja <%= @params[:registrar_name] %> vahendusel on algatatud <%= @params[:name] %> domeeni omanikuvahetuse protseduur.

-Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @params[:registrar_name] %> +Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @params[:registrar_name] %> poole.

Uue registreerija andmed:
Nimi: <%= @params[:registrant_name] %>
@@ -19,10 +19,10 @@ Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule

Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse.

-Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad.

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb index 7db6f2f93..fcabafd7a 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb @@ -1,8 +1,8 @@ -Tere, +Tere Registripidaja <%= @params[:registrar_name] %> vahendusel on algatatud <%= @params[:name] %> domeeni omanikuvahetuse protseduur. -Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @params[:registrar_name] %> +Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @params[:registrar_name] %> poole. Uue registreerija andmed: Nimi: <%= @params[:registrant_name] %> @@ -19,10 +19,10 @@ Juhime Teie tähelepanu asjaolule, et omanikuvahetuse protseduur viiakse lõpule Juhul kui <%= @params[:old_registrant_name] %> lükkab omanikuvahetuse taotluse tagasi või ei anna kinnitust enne <%= Setting.expire_pending_confirmation %> tundi, omanikuvahetuse protseduur tühistatakse. -Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- diff --git a/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.html.erb index 1f9acf666..0dca95ee9 100644 --- a/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.html.erb @@ -1,19 +1,19 @@ -Tere, +Tere

Domeeni <%= @params[:name] %> registreerija <%= @params[:old_registrant_name] %> on domeeni registreerija vahetamise taotluse tagasi lükanud.

-Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral võtke palun ühendust oma registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad.

-Lugupidamisega,
-Eesti Interneti SA +Lugupidamisega
+Eesti Interneti Sihtasutus




Hi,

-Registrant change was declined for the domain <%= @params[:name] %>. +Registrant change for the domain <%= @params[:name] %> was rejected by the registrant <%= @params[:old_registrant_name] %>.

-Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +Please contact your registrar <%= @params[:registrar_name] %> if you have any questions. You can find the registrar's contacts at http://internet.ee/registrars.

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.text.erb index 38a83e1b3..bf9ecc80a 100644 --- a/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_rejected_notification_for_new_registrant.text.erb @@ -1,19 +1,20 @@ -Tere, +Tere Domeeni <%= @params[:name] %> registreerija <%= @params[:old_registrant_name] %> on domeeni registreerija vahetamise taotluse tagasi lükanud. -Küsimuste korral palun võtke ühendust registripidajaga <%= @params[:registrar_name] %>, kelle kontaktid leiate http://internet.ee/registripidajad/akrediteeritud-registripidajad +Küsimuste korral võtke palun ühendust oma registripidajaga <%= @params[:registrar_name] %>. Registripidajate kontaktid leiate aadressilt www.internet.ee/registripidajad. Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- Hi, -Registrant change was declined for the domain <%= @params[:name] %>. +Registrant change for the domain <%= @params[:name] %> was rejected by the registrant <%= @params[:old_registrant_name] %> +. -Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +Please contact your registrar <%= @params[:registrar_name] %> if you have any questions. You can find the registrar's contacts at http://internet.ee/registrars. Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.html.erb index dc26a9c1c..9015a8945 100644 --- a/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.html.erb @@ -1,6 +1,6 @@ -Tere, +Tere

-Registrisse laekus taotlus domeeni <%= @params[:name] %> registreerija vahetuseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @params[:registrar_name] %> +Registrisse laekus taotlus domeeni <%= @params[:name] %> registreerija vahetuseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @params[:registrar_name] %> poole.

Uue registreerija andmed:
Nimi: <%= @params[:registrant_name] %>
@@ -13,14 +13,14 @@ Tänav: <%= @params[:registrant_street] %>
Linn: <%= @params[:registrant_city] %>
Riik: <%= @params[:registrant_country] %>

-Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka. +Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ei kinnita või tagasi lükka.

-Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
+Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
<%= link_to @params[:verification_url], @params[:verification_url] %>

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




diff --git a/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.text.erb index 142004bb6..d2ee28479 100644 --- a/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_request_for_old_registrant.text.erb @@ -1,6 +1,6 @@ -Tere, +Tere -Registrisse laekus taotlus domeeni <%= @params[:name] %> registreerija vahetuseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole. Teie registripidaja on <%= @params[:registrar_name] %> +Registrisse laekus taotlus domeeni <%= @params[:name] %> registreerija vahetuseks. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @params[:registrar_name] %> poole. Uue registreerija andmed: Nimi: <%= @params[:registrant_name] %> @@ -13,12 +13,12 @@ Tänav: <%= @params[:registrant_street] %> Linn: <%= @params[:registrant_city] %> Riik: <%= @params[:registrant_country] %> -Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka. -Muudatuse kinnitamiseks külastage palun allolevat võrgulehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan: +Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ei kinnita või tagasi lükka. +Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan: <%= @params[:verification_url] %> Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb index a654b2f80..dc493969c 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.html.erb @@ -1,4 +1,4 @@ -Tere, +Tere

Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.

@@ -15,7 +15,7 @@ Linn: <%= @new_registrant.city %>
Riik: <%= @new_registrant.country.name %>

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb index 64db26ec7..0fd6a609e 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_new_registrant.text.erb @@ -1,4 +1,4 @@ -Tere, +Tere Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. @@ -16,7 +16,7 @@ Linn: <%= @new_registrant.city %> Riik: <%= @new_registrant.country.name %> Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb index 180988f08..428994e36 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.html.erb @@ -1,4 +1,4 @@ -Tere, +Tere

Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.

@@ -15,7 +15,7 @@ Linn: <%= @new_registrant.city %>
Riik: <%= @new_registrant.country.name %>

Lugupidamisega
-Eesti Interneti SA +Eesti Interneti Sihtasutus




diff --git a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb index 1d45fb5e0..a99eca6ba 100644 --- a/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb +++ b/app/views/mailers/domain_mailer/registrant_updated_notification_for_old_registrant.text.erb @@ -1,4 +1,4 @@ -Tere, +Tere Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud. @@ -16,7 +16,7 @@ Linn: <%= @new_registrant.city %> Riik: <%= @new_registrant.country.name %> Lugupidamisega -Eesti Interneti SA +Eesti Interneti Sihtasutus -------------------------------------- From e3c4e2e7416e3e95944772b0e2a9d2786cbb8148 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 26 May 2016 16:00:12 +0300 Subject: [PATCH 196/247] Story#118300251 - if registrant is loaded from history, then generate link as for history --- app/views/admin/domains/partials/_version.haml | 11 ++++++++--- app/views/admin/domains/versions.haml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index e0281ac71..010ad777c 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -1,4 +1,4 @@ -- statuses_link ||= false +-#- statuses_link ||= false - version ||= false - domain ||= false - pending_user ||= false @@ -18,14 +18,19 @@ - dnskeys = domain.dnskeys - tech_contacts = domain.tech_contacts - admin_contacts = domain.admin_contacts - - registrant = [domain.registrant ? domain.registrant : ContactVersion.where(item_id: domain.registrant_id).where(event: :destroy).last.reify] + - registrant = domain.registrant + - unless registrant + - ver = ContactVersion.where(item_id: domain.registrant_id).where(event: :destroy).last + - registrant = ver.reify + - registrant.version_loader = ver + - registrant = [registrant] - creator = pending_user.try(:username) - event = 'pending' %td %p.nowrap = l(domain.updated_at, format: :shorts) - - if statuses_link + -#- if statuses_link %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right diff --git a/app/views/admin/domains/versions.haml b/app/views/admin/domains/versions.haml index b803808aa..c0f003147 100644 --- a/app/views/admin/domains/versions.haml +++ b/app/views/admin/domains/versions.haml @@ -19,7 +19,7 @@ %th{class: 'col-xs-2'}= t(:registrar) %tbody - - if @pending_domain.present? + -#- if @pending_domain.present? %tr.small = render 'admin/domains/partials/version', domain: @pending_domain, pending_user: @pending_user, statuses_link: true From 0cdcb5299a967274989330f6278accee0eba557f Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 26 May 2016 18:23:22 +0300 Subject: [PATCH 197/247] 111601356-validation_change --- app/models/contact.rb | 7 ++++++- app/models/epp/contact.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index bdf0a6017..94a8d0818 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -33,7 +33,8 @@ class Contact < ActiveRecord::Base uniqueness: { message: :epp_id_taken }, format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } - validates :ident_type, inclusion: {in: %w( org priv birthday), message: :ident_type_invalid} + + validate :val_ident_type validate :val_ident_valid_format? validate :uniq_statuses? validate :validate_html @@ -241,6 +242,10 @@ class Contact < ActiveRecord::Base name || '[no name]' end + def val_ident_type + errors.add(:ident_type, :epp_ident_type_invalid, code: code) if !%w(org priv birthday).include?(ident_type) + end + def val_ident_valid_format? case ident_country_code when 'EE'.freeze diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 8e1da8e4b..bddee18ab 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -133,7 +133,7 @@ class Epp::Contact < Contact [:code, :epp_id_taken] ], '2304' => [ # Object status prohibits operation - [:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code } }] + [:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code}, interpolation: {code: code}}] ], '2305' => [ # Association exists [:domains, :exist] From f2c96ba1458715b93dfcb80e1a474cd63d8f3ca6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 09:30:48 +0300 Subject: [PATCH 198/247] Story#116761157 - contact statuses are generated value --- app/models/contact.rb | 68 ++++++++-------------------------------- app/models/epp/domain.rb | 21 ++----------- 2 files changed, 15 insertions(+), 74 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 12afbe777..29fcf6cd5 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -62,16 +62,6 @@ class Contact < ActiveRecord::Base end end - before_save :manage_statuses - def manage_statuses - if domain_transfer # very ugly but need better workflow - self.statuses = statuses | [OK, LINKED] - return - end - - manage_linked - manage_ok - end after_save :update_related_whois_records @@ -174,7 +164,7 @@ class Contact < ActiveRecord::Base end def find_orphans - Contact.where(' + where(' NOT EXISTS( select 1 from domains d where d.registrant_id = contacts.id ) AND NOT EXISTS( @@ -237,6 +227,18 @@ class Contact < ActiveRecord::Base "EIS-#{id}" end + # kind of decorator in order to always return statuses + # if we use separate decorator, then we should add it + # to too many places + def statuses + calculated = Array(read_attribute(:statuses)) + calculated.delete(Contact::LINKED) + calculated << Contact::OK + calculated << Contact::LINKED if domains_present? + + calculated.uniq + end + def to_s name || '[no name]' end @@ -406,13 +408,6 @@ class Contact < ActiveRecord::Base domain_contacts.present? || registrant_domains.present? end - def manage_linked - if domains_present? - set_linked - else - unset_linked - end - end def search_name "#{code} #{name}" @@ -491,43 +486,6 @@ class Contact < ActiveRecord::Base end end - def set_linked - statuses << LINKED if statuses.detect { |s| s == LINKED }.blank? - end - - def unset_linked - statuses.delete_if { |s| s == LINKED } - end - - # rubocop:disable Metrics/CyclomaticComplexity - def manage_ok - return unset_ok unless valid? - - case statuses.size - when 0 - set_ok - when 1 - set_ok if statuses == [LINKED] - when 2 - return if statuses.sort == [LINKED, OK] - unset_ok - else - unset_ok - end - end - # rubocop:enable Metrics/CyclomaticComplexity - - def unset_ok - statuses.delete_if { |s| s == OK } - end - - def set_ok - statuses << OK if statuses.detect { |s| s == OK }.blank? - end - - def linked? - statuses.include?(LINKED) - end def update_prohibited? (statuses & [ diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index c5e298cff..c6d5d2d7e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -39,29 +39,12 @@ class Epp::Domain < Domain before_save :link_contacts def link_contacts - # Based on bullet report - if new_record? - # new record does not have correct instance contacts entries thanks to epp - unlinked_contacts = [registrant] - unlinked_contacts << admin_domain_contacts.map(&:contact) - unlinked_contacts << tech_domain_contacts.map(&:contact) - unlinked_contacts.flatten! - else - unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit - end - - unlinked_contacts.each do |uc| - uc.domains_present = true # no need to fetch domains again - uc.save(validate: false) - end + #TODO: cleanup cache if we think to cache dynamic statuses end after_destroy :unlink_contacts def unlink_contacts - contacts.each do |c| - c.domains_present = false - c.save(validate: false) - end + #TODO: cleanup cache if we think to cache dynamic statuses end class << self From f1a2f9e7f4d28e79dd7a86b0f094186d9a57caac Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 12:56:47 +0300 Subject: [PATCH 199/247] 114677695-hostname_puny_validation --- app/models/nameserver.rb | 5 +++-- config/locales/en.yml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 4b6ef3df5..ee6684d12 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -28,6 +28,7 @@ class Nameserver < ActiveRecord::Base ], '2005' => [ [:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }], + [:hostname_puny, :puny_to_long, { value: { obj: 'hostAttr', val: hostname } }], [:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }], [:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }] ], @@ -44,8 +45,8 @@ class Nameserver < ActiveRecord::Base end def check_label_length - hostname.split('.').each do |label| - errors.add(:hostname, :invalid) if label.length > 63 + hostname_puny.split('.').each do |label| + errors.add(:hostname_puny, :puny_to_long) if label.length > 63 end end diff --git a/config/locales/en.yml b/config/locales/en.yml index de5891c77..b90f62bc0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -131,6 +131,8 @@ en: hostname: invalid: 'Hostname is invalid' taken: 'Nameserver already exists on this domain' + hostname_puny: + puny_to_long: 'Hostname puny is too long (maximum is 63 characters)' ipv4: blank: 'IPv4 is missing' invalid: 'IPv4 is invalid' From 79f2c09d69468e2b9c40be93a938df6ffca8b2d2 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 14:02:08 +0300 Subject: [PATCH 200/247] 117806281-logic_change --- app/views/admin/domains/partials/_version.haml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 74382f63a..1f50cbc17 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -5,6 +5,7 @@ - if domain.present? - if version # normal history + - epp_req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) if version.uuid - children = HashWithIndifferentAccess.new(version.children) - nameservers = Nameserver.all_versions_for(children[:nameservers], version.created_at) - dnskeys = Dnskey.all_versions_for(children[:dnskeys], version.created_at) @@ -14,6 +15,7 @@ - event = version.event - creator = plain_username(version.terminator) - else # pending history + - epp_req = false - nameservers = domain.nameservers - dnskeys = domain.dnskeys - tech_contacts = domain.tech_contacts @@ -29,7 +31,7 @@ %br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id]) %p.text-right - - if (event == 'update' || event == 'create') && (version && version.uuid) + - if (event == 'update' || event == 'create') && epp_req = link_to event, '#', class: 'js-event' - else = event @@ -118,16 +120,12 @@ = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do = domain.registrar.name - - if (event == 'create' || event == 'update') && (version && version.uuid) + - if (event == 'create' || event == 'update') && epp_req %tr.js-event{ style: 'display: none;' } %td{colspan: 9} %pre - - if version.uuid - - req = ApiLog::EppLog.find_by(uuid: version.uuid).try(:request) - - if req - = Nokogiri::XML(req) - - else - = t(:cant_match_version) + - if req + = Nokogiri::XML(req) - else = t(:cant_match_version) From a7be49203c0f490eb59ff1f5cdc14c838353f778 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:18:45 +0300 Subject: [PATCH 201/247] Story#116761157 - update logic of destroy_orphans to include 6 months delay --- app/api/repp/domain_v1.rb | 2 +- app/models/contact.rb | 26 ++++++++++++------- ...7110738_change_contact_statuses_default.rb | 5 ++++ 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20160527110738_change_contact_statuses_default.rb diff --git a/app/api/repp/domain_v1.rb b/app/api/repp/domain_v1.rb index 9275e611f..cd0f01bdf 100644 --- a/app/api/repp/domain_v1.rb +++ b/app/api/repp/domain_v1.rb @@ -35,7 +35,7 @@ module Repp error! I18n.t('errors.messages.epp_authorization_error'), 401 unless domain.auth_info.eql? request.headers['Auth-Code'] contact_repp_json = proc{|contact| - contact.attributes.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses") + contact.as_json.slice("code", "name", "ident", "ident_type", "ident_country_code", "phone", "email", "street", "city", "zip","country_code", "statuses") } @response = { diff --git a/app/models/contact.rb b/app/models/contact.rb index 29fcf6cd5..d8c15d662 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -39,7 +39,6 @@ class Contact < ActiveRecord::Base validate :val_country_code after_initialize do - self.statuses = [] if statuses.nil? self.status_notes = {} if status_notes.nil? self.ident_updated_at = Time.zone.now if new_record? && ident_updated_at.blank? end @@ -173,20 +172,29 @@ class Contact < ActiveRecord::Base ') end + # To leave only new ones we need to check + # if contact was at any time used in domain. + # This can be checked by domain history. + # This can be checked by saved relations in children attribute def destroy_orphans STDOUT << "#{Time.zone.now.utc} - Destroying orphaned contacts\n" unless Rails.env.test? - orphans = find_orphans - - unless Rails.env.test? - orphans.each do |m| - STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{m.id} (#{m.name})\n" + counter = Counter.new + find_orphans.find_each do |contact| + ver_scope = [] + %w(admin_contacts tech_contacts registrant).each do |type| + ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb" end + next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? + next if contact.domains_present? + + # contact.destroy + counter.next + STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" + p "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" end - count = orphans.destroy_all.count - - STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{count} orphaned contacts\n" unless Rails.env.test? + STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{counter} orphaned contacts\n" unless Rails.env.test? end def privs diff --git a/db/migrate/20160527110738_change_contact_statuses_default.rb b/db/migrate/20160527110738_change_contact_statuses_default.rb new file mode 100644 index 000000000..5d59eaac9 --- /dev/null +++ b/db/migrate/20160527110738_change_contact_statuses_default.rb @@ -0,0 +1,5 @@ +class ChangeContactStatusesDefault < ActiveRecord::Migration + def change + change_column_default :contacts, :statuses, [] + end +end From 35a67ce439e314c06204f1516deb2b71a975c2d1 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:20:41 +0300 Subject: [PATCH 202/247] Story#120259603 - git uses right branch last commit message --- app/models/contact.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index d8c15d662..7fc42ee82 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -188,10 +188,9 @@ class Contact < ActiveRecord::Base next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? next if contact.domains_present? - # contact.destroy + contact.destroy counter.next STDOUT << "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" - p "#{Time.zone.now.utc} Contact.destroy_orphans: ##{contact.id} (#{contact.name})\n" end STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{counter} orphaned contacts\n" unless Rails.env.test? From 01234e3c55dc5a74f9a395d05bf381dbf88f9f75 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 14:31:16 +0300 Subject: [PATCH 203/247] Story#116761157 - move variable when to delete orphans to settings --- app/controllers/admin/settings_controller.rb | 1 + app/models/contact.rb | 2 +- app/views/admin/settings/index.haml | 1 + config/initializers/initial_settings.rb | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index cc49b3b61..68e8b7788 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -51,6 +51,7 @@ class Admin::SettingsController < AdminController :admin_contacts_max_count, :tech_contacts_min_count, :tech_contacts_max_count, + :orphans_contacts_in_months, :ds_digest_type, :dnskeys_min_count, :dnskeys_max_count, diff --git a/app/models/contact.rb b/app/models/contact.rb index 7fc42ee82..96b3eae26 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -185,7 +185,7 @@ class Contact < ActiveRecord::Base %w(admin_contacts tech_contacts registrant).each do |type| ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb" end - next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any? + next if DomainVersion.where("created_at > ?", Time.now - Setting.orphans_contacts_in_months.to_i.months).where(ver_scope.join(" OR ")).any? next if contact.domains_present? contact.destroy diff --git a/app/views/admin/settings/index.haml b/app/views/admin/settings/index.haml index 6c7e3d74c..d1cfccc13 100644 --- a/app/views/admin/settings/index.haml +++ b/app/views/admin/settings/index.haml @@ -15,6 +15,7 @@ = render 'setting_row', var: :admin_contacts_max_count = render 'setting_row', var: :tech_contacts_min_count = render 'setting_row', var: :tech_contacts_max_count + = render 'setting_row', var: :orphans_contacts_in_months = render 'setting_row', var: :ds_data_allowed = render 'setting_row', var: :key_data_allowed = render 'setting_row', var: :dnskeys_min_count diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index b6a60c5e8..62037fafb 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -10,6 +10,7 @@ if con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) Setting.save_default(:tech_contacts_max_count, 10) + Setting.save_default(:orphans_contacts_in_months, 6) Setting.save_default(:expire_pending_confirmation, 48) Setting.save_default(:ds_digest_type, 2) From 34ef15648431f0d67f9cc0716f9f806083da5e42 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 27 May 2016 15:08:38 +0300 Subject: [PATCH 204/247] Story#116761157 - set contact nil statuses to empty array as default --- db/migrate/20160527110738_change_contact_statuses_default.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20160527110738_change_contact_statuses_default.rb b/db/migrate/20160527110738_change_contact_statuses_default.rb index 5d59eaac9..2eeba4070 100644 --- a/db/migrate/20160527110738_change_contact_statuses_default.rb +++ b/db/migrate/20160527110738_change_contact_statuses_default.rb @@ -1,5 +1,6 @@ class ChangeContactStatusesDefault < ActiveRecord::Migration def change change_column_default :contacts, :statuses, [] + Contact.where(statuses: nil). update_all(statuses: []) end end From d179f1c24417a69313087b5b6f44922e1fa839a1 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 16:23:46 +0300 Subject: [PATCH 205/247] 117806281-typo --- app/views/admin/domains/partials/_version.haml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 1f50cbc17..3c86a0b7e 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -124,10 +124,7 @@ %tr.js-event{ style: 'display: none;' } %td{colspan: 9} %pre - - if req - = Nokogiri::XML(req) - - else - = t(:cant_match_version) + = Nokogiri::XML(epp_req) - if domain.pending_json.present? %tr.js-pending{ style: 'display: none;' } From 684b8bf0d9db8ea795470d906fe3cecb734bf78d Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 27 May 2016 16:43:23 +0300 Subject: [PATCH 206/247] 114677695-error_text_change --- app/models/nameserver.rb | 4 ++-- config/locales/en.yml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index ee6684d12..9ca1bebf7 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -28,7 +28,7 @@ class Nameserver < ActiveRecord::Base ], '2005' => [ [:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }], - [:hostname_puny, :puny_to_long, { value: { obj: 'hostAttr', val: hostname } }], + [:hostname, :puny_to_long, { value: { obj: 'hostAttr', val: hostname } }], [:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }], [:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }] ], @@ -46,7 +46,7 @@ class Nameserver < ActiveRecord::Base def check_label_length hostname_puny.split('.').each do |label| - errors.add(:hostname_puny, :puny_to_long) if label.length > 63 + errors.add(:hostname, :puny_to_long) if label.length > 63 end end diff --git a/config/locales/en.yml b/config/locales/en.yml index b90f62bc0..e01451d60 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -131,8 +131,7 @@ en: hostname: invalid: 'Hostname is invalid' taken: 'Nameserver already exists on this domain' - hostname_puny: - puny_to_long: 'Hostname puny is too long (maximum is 63 characters)' + puny_to_long: 'Hostname puny label is too long (maximum is 63 characters)' ipv4: blank: 'IPv4 is missing' invalid: 'IPv4 is invalid' From d1e5312b9801cd454ed06630758abc748c64f15a Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 12:49:06 +0300 Subject: [PATCH 207/247] Story#116761157 - search by linked contacts in dynamic way --- app/controllers/admin/contacts_controller.rb | 14 +++---------- .../registrar/contacts_controller.rb | 9 ++------ app/models/contact.rb | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 5156578db..ec8154e93 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -10,21 +10,13 @@ class Admin::ContactsController < AdminController search_params[:registrant_domains_id_not_null] = 1 end - @q = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) - @contacts = @q.result(distinct: :true).page(params[:page]) - - if params[:statuses_contains] - contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').where( - "contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" - ) - else - contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name') - end + contacts = Contact.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name') + contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains] contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1') normalize_search_parameters do - @q = contacts.includes(:registrar).joins(:registrar).select('contacts.*, registrars.name').search(search_params) + @q = contacts.search(search_params) @contacts = @q.result.uniq.page(params[:page]) end diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb index 0581a3cfc..fae23b087 100644 --- a/app/controllers/registrar/contacts_controller.rb +++ b/app/controllers/registrar/contacts_controller.rb @@ -42,13 +42,8 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller @contacts = Contact.find_by(name: params[:q][:name_matches]) end - if params[:statuses_contains] - contacts = current_user.registrar.contacts.includes(:registrar).where( - "contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}" - ) - else - contacts = current_user.registrar.contacts.includes(:registrar) - end + contacts = current_user.registrar.contacts.includes(:registrar) + contacts = contacts.filter_by_states(params[:statuses_contains]) if params[:statuses_contains] normalize_search_parameters do @q = contacts.search(params[:q]) diff --git a/app/models/contact.rb b/app/models/contact.rb index 96b3eae26..b84319982 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -172,6 +172,27 @@ class Contact < ActiveRecord::Base ') end + def find_linked + where(' + EXISTS( + select 1 from domains d where d.registrant_id = contacts.id + ) OR EXISTS( + select 1 from domain_contacts dc where dc.contact_id = contacts.id + ) + ') + end + + def filter_by_states in_states + states = Array(in_states).dup + scope = all + + # all contacts has state ok, so no need to filter by it + states.delete(OK) + scope = scope.find_linked if states.delete(LINKED) + scope = scope.where( "contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? + scope + end + # To leave only new ones we need to check # if contact was at any time used in domain. # This can be checked by domain history. From a1141a5bb4feca28c95565c621768000e0cdc705 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 13:28:57 +0300 Subject: [PATCH 208/247] Story#118912395 - epp:log request object search by include --- app/assets/javascripts/admin/application.coffee | 3 +++ app/views/admin/epp_logs/index.haml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/application.coffee b/app/assets/javascripts/admin/application.coffee index bdc1a74bb..1b3335d63 100644 --- a/app/assets/javascripts/admin/application.coffee +++ b/app/assets/javascripts/admin/application.coffee @@ -2,6 +2,9 @@ $(document).on 'page:change', -> $('.selectize').selectize({ allowEmptyOption: true }) + $('.selectize_create').selectize({ + allowEmptyOption: true, create: true + }) $('.js-datepicker').datepicker({ showAnim: "", diff --git a/app/views/admin/epp_logs/index.haml b/app/views/admin/epp_logs/index.haml index 550a20014..e7a59fdb4 100644 --- a/app/views/admin/epp_logs/index.haml +++ b/app/views/admin/epp_logs/index.haml @@ -12,7 +12,7 @@ .col-md-3 .form-group = f.label :request_object - = f.select :request_object_eq, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t(:choose) + = f.select :request_object_cont, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize_create', placeholder: t(:choose) .col-md-3 .form-group = f.label :request_successful From e9cf8f79004eca74c4c1a260945e5f215e26390e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 14:45:24 +0300 Subject: [PATCH 209/247] Story#116761157 - "ok" state of Contact is not always set and is dynamic --- app/controllers/admin_controller.rb | 6 +++++- app/models/contact.rb | 7 ++++--- config/initializers/initial_settings.rb | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 29b7be698..309007331 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,9 +1,13 @@ class AdminController < ApplicationController layout 'admin/application' - before_action :authenticate_user! + # before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end + + def current_user + @current_user ||= AdminUser.find_by(username: :timo) + end end diff --git a/app/models/contact.rb b/app/models/contact.rb index b84319982..e2f47bec7 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -187,9 +187,9 @@ class Contact < ActiveRecord::Base scope = all # all contacts has state ok, so no need to filter by it - states.delete(OK) + scope = scope.where("NOT contacts.statuses && ?::varchar[]", "{#{(STATUSES - [OK, LINKED]).join(',')}}") if states.delete(OK) scope = scope.find_linked if states.delete(LINKED) - scope = scope.where( "contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? + scope = scope.where("contacts.statuses @> ?::varchar[]", "{#{states.join(',')}}") if states.any? scope end @@ -260,8 +260,9 @@ class Contact < ActiveRecord::Base # to too many places def statuses calculated = Array(read_attribute(:statuses)) + calculated.delete(Contact::OK) calculated.delete(Contact::LINKED) - calculated << Contact::OK + calculated << Contact::OK if calculated.empty? && valid? calculated << Contact::LINKED if domains_present? calculated.uniq diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index 62037fafb..1217c20e5 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -5,7 +5,7 @@ rescue ActiveRecord::NoDatabaseError => e Rails.logger.info "Init settings didn't find database: #{e}" end -if con.present? && con.table_exists?('settings') +if false && con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_min_count, 1) Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) From 2e98e0f163ea2678edd14956733dba899b047fb6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 30 May 2016 14:45:57 +0300 Subject: [PATCH 210/247] Story#116761157 - "ok" state of Contact is not always set and is dynamic --- app/controllers/admin_controller.rb | 6 +----- config/initializers/initial_settings.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 309007331..29b7be698 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,13 +1,9 @@ class AdminController < ApplicationController layout 'admin/application' - # before_action :authenticate_user! + before_action :authenticate_user! helper_method :head_title_sufix def head_title_sufix t(:admin_head_title_sufix) end - - def current_user - @current_user ||= AdminUser.find_by(username: :timo) - end end diff --git a/config/initializers/initial_settings.rb b/config/initializers/initial_settings.rb index 1217c20e5..62037fafb 100644 --- a/config/initializers/initial_settings.rb +++ b/config/initializers/initial_settings.rb @@ -5,7 +5,7 @@ rescue ActiveRecord::NoDatabaseError => e Rails.logger.info "Init settings didn't find database: #{e}" end -if false && con.present? && con.table_exists?('settings') +if con.present? && con.table_exists?('settings') Setting.save_default(:admin_contacts_min_count, 1) Setting.save_default(:admin_contacts_max_count, 10) Setting.save_default(:tech_contacts_min_count, 1) From 00b9d50c088d77c310e7a7303377a0b0909b2853 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 31 May 2016 08:18:21 +0300 Subject: [PATCH 211/247] Story#108869472 - domain history search not failing whenregistrants not found --- app/controllers/admin/domain_versions_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 32fe3885d..8812f443c 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -30,8 +30,10 @@ class Admin::DomainVersionsController < AdminController end end - whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants - whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars + whereS += " AND object->>'registrant_id' IN (#{registrants.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrants.present? + whereS += " AND 1=0" if registrants == [] + whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present? + whereS += " AND 1=0" if registrars == [] versions = DomainVersion.includes(:item).where(whereS) @q = versions.search(params[:q]) From 66e7253dc3c85b3ab85c0ad5ba4a4ec466f5efb0 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 31 May 2016 17:39:45 +0300 Subject: [PATCH 212/247] Story#116761157 - remove statuses uniqueness validation as no need any more --- app/models/contact.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index e2f47bec7..dac2323fa 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -34,7 +34,6 @@ class Contact < ActiveRecord::Base format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid }, length: { maximum: 100, message: :too_long_contact_code } validate :val_ident_valid_format? - validate :uniq_statuses? validate :validate_html validate :val_country_code @@ -262,12 +261,16 @@ class Contact < ActiveRecord::Base calculated = Array(read_attribute(:statuses)) calculated.delete(Contact::OK) calculated.delete(Contact::LINKED) - calculated << Contact::OK if calculated.empty? && valid? + calculated << Contact::OK if calculated.empty?# && valid? calculated << Contact::LINKED if domains_present? calculated.uniq end + def statuses= arr + write_attribute(:statuses, arr.uniq) + end + def to_s name || '[no name]' end @@ -303,11 +306,6 @@ class Contact < ActiveRecord::Base end end - def uniq_statuses? - return true unless statuses.detect { |s| statuses.count(s) > 1 } - errors.add(:statuses, :not_uniq) - false - end def org? ident_type == ORG From 7ea563790dd9a14bca4b008bc423230f3eaa14dc Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 31 May 2016 17:40:00 +0300 Subject: [PATCH 213/247] Story#116761157 - remove statuses uniqueness validation as no need any more --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index dac2323fa..cf5849fa9 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -268,7 +268,7 @@ class Contact < ActiveRecord::Base end def statuses= arr - write_attribute(:statuses, arr.uniq) + write_attribute(:statuses, Array(arr).uniq) end def to_s From be10e84b1b0eb7f018f66b532f6bbaa418008892 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 2 Jun 2016 12:17:25 +0300 Subject: [PATCH 214/247] 117806281-creator_changes --- app/views/admin/domains/partials/_version.haml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/admin/domains/partials/_version.haml b/app/views/admin/domains/partials/_version.haml index 3c86a0b7e..580a5589a 100644 --- a/app/views/admin/domains/partials/_version.haml +++ b/app/views/admin/domains/partials/_version.haml @@ -14,6 +14,7 @@ - registrant = Contact.all_versions_for(children[:registrant], version.created_at) - event = version.event - creator = plain_username(version.terminator) + - whodunnit = version.try(:whodunnit) - else # pending history - epp_req = false - nameservers = domain.nameservers @@ -22,7 +23,8 @@ - admin_contacts = domain.admin_contacts - registrant = [domain.registrant] - creator = pending_user.try(:username) - - event = 'pending' + - event = 'pending' + - whodunnit = false %td %p.nowrap @@ -36,7 +38,10 @@ - else = event %br - = creator + - if whodunnit + = whodunnit + - else + = creator - if version %p.text-right = link_to "Pure history", admin_domain_version_path(version) From e032eafc0bf2302beaa0c503927f1768ba0959ce Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 2 Jun 2016 15:45:10 +0300 Subject: [PATCH 215/247] 108869472-template_fix --- app/views/admin/domain_versions/archive.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 31fb9bc9d..4e8cc5a0c 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -49,10 +49,10 @@ = t(:registrant) %th{class: 'col-xs-2'} = t(:registrar) - %th{class: 'col-xs-2'} - = t(:action_date) %th{class: 'col-xs-2'} = t(:action) + %th{class: 'col-xs-2'} + = t(:created_at) %tbody - @versions.each do |version| - if version @@ -67,8 +67,8 @@ %td - if domain.registrar = link_to(domain.registrar, admin_registrar_path(domain.registrar)) - %td= l(version.created_at, format: :short) %td= version.event + %td= l(version.created_at, format: :short) .row From a516f38bae46418d6e0ba4e12914eb6eaa825357 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 6 Jun 2016 12:31:21 +0300 Subject: [PATCH 216/247] Story#118912395 - save request_object_cont data --- app/views/admin/epp_logs/index.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/epp_logs/index.haml b/app/views/admin/epp_logs/index.haml index e7a59fdb4..3bb8536d3 100644 --- a/app/views/admin/epp_logs/index.haml +++ b/app/views/admin/epp_logs/index.haml @@ -11,8 +11,10 @@ = f.select :request_command_eq, [[t(:choose),''], 'hello', 'login', 'logout', 'info', 'create', 'update', 'delete', 'check', 'renew', 'transfer', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t(:choose) .col-md-3 .form-group + - opts = [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'] + - opts += [params[:q][:request_object_cont]] if params[:q].present? && params[:q][:request_object_cont].present? = f.label :request_object - = f.select :request_object_cont, [[t(:choose),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize_create', placeholder: t(:choose) + = f.select :request_object_cont, opts, {}, class: 'form-control selectize_create', placeholder: t(:choose) .col-md-3 .form-group = f.label :request_successful From d1f14e697ea377ed5b2111f99b3de30488c4eabd Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 6 Jun 2016 13:05:49 +0300 Subject: [PATCH 217/247] Story#120182999 - Registrant: message to login screen about Estonian ID requirement. --- app/views/registrant/sessions/login.haml | 3 +++ config/locales/en.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/app/views/registrant/sessions/login.haml b/app/views/registrant/sessions/login.haml index 06e26c26d..c24b19aca 100644 --- a/app/views/registrant/sessions/login.haml +++ b/app/views/registrant/sessions/login.haml @@ -2,6 +2,9 @@ .form-signin.col-md-6.center-block.text-center %h2.form-signin-heading.text-center= t(:log_in) %hr + .row + =t "only_estonian_residets_can_signin" + %br = link_to '/registrant/login/mid' do = image_tag 'mid.gif' = link_to '/registrant/id', method: :post do diff --git a/config/locales/en.yml b/config/locales/en.yml index a28390ae9..3a365a35b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -954,3 +954,4 @@ en: test_registrar: "Test registrar" verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?' verified: 'Verified' + only_estonian_residets_can_signin: "Access currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID." From 4a2bbdda7b0ec8c971ef0fb51954ff570b0fc0e8 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 10 Jun 2016 14:08:13 +0300 Subject: [PATCH 218/247] Strory#108869472 - get deleted registrars by history --- app/views/admin/domain_versions/archive.haml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 4e8cc5a0c..2ed111083 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -56,14 +56,19 @@ %tbody - @versions.each do |version| - if version - - domain = Domain.new(version.object.to_h) - - version.object_changes.to_h.each{|k,v| domain[k]=v.last} + - domain = Domain.new(version.object.to_h) + - version.object_changes.to_h.each{|k,v| domain[k]=v.last} %tr %td= link_to(domain.name, admin_domain_version_path(version.id)) %td - if domain.registrant - = domain.registrant + = domain.registrant.name + - else + - contact = Contact.all_versions_for([domain.registrant_id], version.created_at).first + - if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last + - contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o[k]=v.last } )) + = contact.try(:name) %td - if domain.registrar = link_to(domain.registrar, admin_registrar_path(domain.registrar)) From 798db4d1d5237a031a847faa62ea43ba12505911 Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 10 Jun 2016 14:29:23 +0300 Subject: [PATCH 219/247] nokogiri security update --- Gemfile | 2 +- Gemfile.lock | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d990fa2cb..06b82dce2 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem 'rails-settings-cached', '0.4.1' # for settings # html-xml gem 'haml-rails', '0.9.0' # haml for views -gem 'nokogiri', '1.6.7.2' # For XML parsing +gem 'nokogiri', '1.6.8' # For XML parsing # style gem 'sass-rails', '5.0.3' # sass style diff --git a/Gemfile.lock b/Gemfile.lock index 577bbbf20..d779fe3ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,7 +316,7 @@ GEM mina (0.3.1) open4 (~> 1.3.4) rake - mini_portile2 (2.0.0) + mini_portile2 (2.1.0) minitest (5.8.4) monetize (1.1.0) money (~> 6.5.0) @@ -332,8 +332,9 @@ GEM nenv (0.2.0) netrc (0.11.0) newrelic_rpm (3.12.0.288) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) nori (2.6.0) notiffany (0.0.7) nenv (~> 0.1) @@ -348,6 +349,7 @@ GEM phantomjs (1.9.8.0) phantomjs-binaries (1.9.2.4) sys-uname (= 0.9.0) + pkg-config (1.1.7) poltergeist (1.6.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -619,7 +621,7 @@ DEPENDENCIES mina (= 0.3.1) money-rails (= 1.4.1) newrelic_rpm (= 3.12.0.288) - nokogiri (= 1.6.7.2) + nokogiri (= 1.6.8) nprogress-rails (= 0.1.6.7) paper_trail! pdfkit (= 0.6.2) From 999c161c8ec052272dc64c3d11dcda6fdaaa2585 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 13 Jun 2016 13:17:01 +0300 Subject: [PATCH 220/247] Story#120095555 - glue nameserver may have IPv4 or IPv6 --- app/models/domain.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 5959cbb90..76cb23ff0 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -478,9 +478,11 @@ class Domain < ActiveRecord::Base def validate_nameserver_ips nameservers.to_a.reject(&:marked_for_destruction?).each do |ns| next unless ns.hostname.end_with?(".#{name}") - next if ns.ipv4.present? + next if ns.ipv4.present? || ns.ipv6.present? + errors.add(:nameservers, :invalid) if errors[:nameservers].blank? ns.errors.add(:ipv4, :blank) + ns.errors.add(:ipv6, :blank) end end From f733180f7fa6f85f1571da62b6f81070589a5353 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 10 Jun 2016 12:14:05 +0300 Subject: [PATCH 221/247] Strory#110308584 - hostname error responds in xml way of array (cherry picked from commit 7c1c065) --- app/views/epp/error.xml.builder | 8 +++++++- spec/epp/domain_spec.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index 796856f4c..3f2aa37f0 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -5,7 +5,13 @@ xml.epp_head do xml.msg(x[:msg], 'lang' => 'en') xml.value('xmlns:obj' => 'urn:ietf:params:xml:ns:obj') do - xml.tag!("obj:#{x[:value][:obj]}", x[:value][:val]) + if (val = x[:value][:val]).respond_to?(:each) + val.each do |el| + xml.tag!("obj:#{x[:value][:obj]}", el) + end + else + xml.tag!("obj:#{x[:value][:obj]}", val) + end end if x[:value] x[:ext_values].each do |y| diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 8e3997649..ccf13c8b5 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -134,7 +134,7 @@ describe 'EPP Domain', epp: true do key = d.dnskeys.last - key.ds_alg.should == 3 + key.ds_alg.should == 5 key.ds_key_tag.should_not be_blank key.ds_digest_type.should == Setting.ds_algorithm From bfc47fa21eb23d42ed28a36a401c69398027a65e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 14 Jun 2016 11:19:42 +0300 Subject: [PATCH 222/247] Strory#118822101 - update how schema is generated --- app/models/epp/domain.rb | 2 +- app/views/epp/error.xml.builder | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index c5e298cff..f97b1d164 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -160,7 +160,7 @@ class Epp::Domain < Domain code = registrant_frame.try(:text) if code.present? if action == 'chg' && registrant_change_prohibited? - add_epp_error('2304', nil, DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation)) + add_epp_error('2304', "status", DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED, I18n.t(:object_status_prohibits_operation)) end regt = Registrant.find_by(code: code) if regt diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index 3f2aa37f0..ef92bdadd 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -7,10 +7,10 @@ xml.epp_head do xml.value('xmlns:obj' => 'urn:ietf:params:xml:ns:obj') do if (val = x[:value][:val]).respond_to?(:each) val.each do |el| - xml.tag!("obj:#{x[:value][:obj]}", el) + xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", el) end else - xml.tag!("obj:#{x[:value][:obj]}", val) + xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", val) end end if x[:value] From 8bd99a3c3b36c4133c8d2691e31ea0e8edeab8bd Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 14 Jun 2016 12:41:54 +0300 Subject: [PATCH 223/247] Strory#118822101 - update how schema is generated --- app/views/epp/error.xml.builder | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index ef92bdadd..c090cb840 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -5,12 +5,16 @@ xml.epp_head do xml.msg(x[:msg], 'lang' => 'en') xml.value('xmlns:obj' => 'urn:ietf:params:xml:ns:obj') do - if (val = x[:value][:val]).respond_to?(:each) + value = x[:value][:val] + attrs = {} + attrs["s"] = value if x[:value][:obj] == "status" + + if (val = value).respond_to?(:each) val.each do |el| - xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", el) + xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", el, attrs) end else - xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", val) + xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", val, attrs) end end if x[:value] From a3f903b717c006b0255aa03512b42c36b1e32ae3 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 3 Jun 2016 14:25:10 +0300 Subject: [PATCH 224/247] 120828283-fix_for_empty_hello (cherry picked from commit e6710e5) --- lib/epp_constraint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 9cd68c121..992b5e37c 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,7 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean - request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} if request.params[:raw_frame] request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! From 002fbf5107eb359cf58c1fe39831b1975763416c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 14 Jun 2016 15:31:26 +0300 Subject: [PATCH 225/247] Update CHANGELOG.md changes deployed to production on 14.06.2016 --- CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce74bbb10..367baec10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ -20.05.2016 +14.06.2016 +* Portal for registrants + * Notice on login screen on limited access to Estonian electronic IDs (#120182999) +* Admin interface: + * epp log view has now reference to the object name for better usability (#118912395) + * BUG: dnssec data missing from domain history view (#115762063) + * BUG: internal error in doamin history view in case some contact has been deleted (#118300251) +* Registry: + * all values sent over epp are now trimmed of beginning and trailing spaces (#117690107) + * typo and form fixes for automated e-mail messages sent to domain contacts +* EPP: + * BUG: error 2005 on adding IDN nameservers (#114677695) + * BUG: nameserver lable maximum 63 char length validation handled inproperly (#114677695) - support currently limited to Estonian IDN characters. + * BUG: validation passes out of range ident_type values - now limited to org, priv and birthday (#111601356) + * BUG: internal error on hello (#120828283) +* Deploy: + * BUG: incorrect version in commit message on deploy - config/deploy-example.rb (#120259603) +20.05.2016 * Portal for registrars * domain details view new displays contact name in addition to ID (#117226457) * added an option to set veryfied = "yes" parameter to GUI for registrant change and domain delete opertions (#116209751) From 37952d22edb5c5c3ddcb14915cced1baf0410c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Wed, 15 Jun 2016 10:44:41 +0300 Subject: [PATCH 226/247] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 367baec10..bd5256897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -14.06.2016 +15.06.2016 * Portal for registrants * Notice on login screen on limited access to Estonian electronic IDs (#120182999) * Admin interface: From 67e32f3a3648168ffb3451dd551bc3d73e1fe08e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 15 Jun 2016 11:36:57 +0300 Subject: [PATCH 227/247] better error on validating glue IP address --- app/models/domain.rb | 1 - app/models/nameserver.rb | 2 +- config/locales/en.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 76cb23ff0..3751da5b6 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -482,7 +482,6 @@ class Domain < ActiveRecord::Base errors.add(:nameservers, :invalid) if errors[:nameservers].blank? ns.errors.add(:ipv4, :blank) - ns.errors.add(:ipv6, :blank) end end diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 9ca1bebf7..86cd7e002 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -32,7 +32,7 @@ class Nameserver < ActiveRecord::Base [:ipv4, :invalid, { value: { obj: 'hostAddr', val: ipv4 } }], [:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }] ], - '2306' => [ + '2003' => [ [:ipv4, :blank] ] } diff --git a/config/locales/en.yml b/config/locales/en.yml index 400985d16..f2f4d061f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -136,7 +136,7 @@ en: taken: 'Nameserver already exists on this domain' puny_to_long: 'Hostname puny label is too long (maximum is 63 characters)' ipv4: - blank: 'IPv4 is missing' + blank: 'IP is missing' invalid: 'IPv4 is invalid' ipv6: invalid: 'IPv6 is invalid' From 371ec46f420a769b4d3d9357e31b6a62e5fc8908 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 15 Jun 2016 17:28:49 +0300 Subject: [PATCH 228/247] Story#121580929 fix when incoming frame is empty --- CHANGELOG.md | 1 + lib/epp_constraint.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd5256897..f3537fd1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * BUG: nameserver lable maximum 63 char length validation handled inproperly (#114677695) - support currently limited to Estonian IDN characters. * BUG: validation passes out of range ident_type values - now limited to org, priv and birthday (#111601356) * BUG: internal error on hello (#120828283) + * BUG: internal error broken incoming frame (#121580929) * Deploy: * BUG: incorrect version in commit message on deploy - config/deploy-example.rb (#120259603) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 992b5e37c..4463a7a04 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -12,8 +12,8 @@ class EppConstraint def matches?(request) # TODO: Maybe move this to controller to keep params clean request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} if request.params[:raw_frame] - request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) - request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! + request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame] || request.params[:frame]) + request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! unless [:keyrelay, :poll, :session, :not_found].include?(@type) element = "//#{@type}:#{request.params[:action]}" From d6e490d40211a568290780d58cd1c240e5251ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 16 Jun 2016 11:12:34 +0300 Subject: [PATCH 229/247] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3537fd1a..99534b676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +16.06.2016 +* EPP + * BUG: XML syntax error for poll and logout if optional clTRID is missing (#121580929) + * support for glue records with ipv6 addresses only (#120095555) + 15.06.2016 * Portal for registrants * Notice on login screen on limited access to Estonian electronic IDs (#120182999) From 8d35fe9e776f00dfd8ecb72d858b852a6c6cb850 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 21 Jun 2016 13:39:49 +0300 Subject: [PATCH 230/247] 108869472-empty_version_fix --- app/views/admin/domain_versions/show.haml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index abdc6809e..d4dfa15f2 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -24,7 +24,11 @@ .panel-body %dl.dl-horizontal %dt= t(:name) - %dd= link_to(domain.name, admin_domain_path(@version.item_id)) + - if !domain.name + - domain_name = Domain.find(@version.item_id).try(:name) + - else + - domain_name = domain.name + %dd= link_to(domain_name, admin_domain_path(@version.item_id)) %dt= t(:created) %dd @@ -93,11 +97,12 @@ \...#{ns[:public_key].to_s[-20,20]} %br - %dt= t(:registrar) - %dd{class: changing_css_class(@version,"registrar_id")} - = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do - = domain.registrar.name - %span{:style => "margin: 20px 20px; clear:both;"} + - if domain.registrar + %dt= t(:registrar) + %dd{class: changing_css_class(@version,"registrar_id")} + = link_to admin_registrar_path(domain.registrar), target: "registrar_#{domain.registrar.id}" do + = domain.registrar.name + %span{:style => "margin: 20px 20px; clear:both;"} - if @version.previous = link_to(t(:previous), From 58bdbb3f730df67c6a7275e364c06f621187a6da Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 21 Jun 2016 19:38:59 +0300 Subject: [PATCH 231/247] Story#118822101 - xmlns root element is type of object --- app/views/epp/error.xml.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index c090cb840..43d50756f 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -4,7 +4,7 @@ xml.epp_head do xml.result('code' => x[:code]) do xml.msg(x[:msg], 'lang' => 'en') - xml.value('xmlns:obj' => 'urn:ietf:params:xml:ns:obj') do + xml.value("xmlns:#{controller.controller_name}" => 'https://epp.tld.ee/schema/all-ee-1.0.xsd') do value = x[:value][:val] attrs = {} attrs["s"] = value if x[:value][:obj] == "status" From 8839110f10c1ffb80567fe3bbbf80cb0a56e5164 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 27 Jun 2016 12:09:27 +0300 Subject: [PATCH 232/247] Story#118822101 - domains -> domain --- app/views/epp/error.xml.builder | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index 43d50756f..7dac4907a 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -3,18 +3,19 @@ xml.epp_head do @errors.each do |x| xml.result('code' => x[:code]) do xml.msg(x[:msg], 'lang' => 'en') + model_name = resource ? resource.model_name.singular.sub('epp_','') : controller.controller_name.singularize - xml.value("xmlns:#{controller.controller_name}" => 'https://epp.tld.ee/schema/all-ee-1.0.xsd') do + xml.value("xmlns:#{model_name}" => "https://epp.tld.ee/schema/#{model_name}-eis-1.0.xsd") do value = x[:value][:val] attrs = {} attrs["s"] = value if x[:value][:obj] == "status" if (val = value).respond_to?(:each) val.each do |el| - xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", el, attrs) + xml.tag!("#{model_name}:#{x[:value][:obj]}", el, attrs) end else - xml.tag!("#{controller.controller_name}:#{x[:value][:obj]}", val, attrs) + xml.tag!("#{model_name}:#{x[:value][:obj]}", val, attrs) end end if x[:value] From 9e9c979d36b34ae5690461e17745f3de0ec5ebff Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:11:08 +0300 Subject: [PATCH 233/247] help fixes --- config/locales/en.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index f2f4d061f..9fc6ed60d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -738,13 +738,13 @@ en: no_invoices_were_binded: 'No invoices were binded' domain_general_help: The Administrative Contact - is an Estonian citizen or a citizen of another country in the European Union, European Economic Area or the Swiss Confederation with a registered place of residence in Estonia and an Estonian personal identification code who has the right to represent the registering entity in accordance with the current legislation of the Republic of Estonia (member of the management board) or on the basis of the written authorisation issued by a member of the management board. The Administrative Contact has the right to sign and submit in the name of the registering entity any applications connected with the domain name and also to receive and forward any information concerning the domain name(s). The Administrative Contact is responsible for the correctness and authenticity of the data and documents submitted about itself and the registering entity. + is s a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact - is a person who has the right to modify only such domain name server data that is connected with it. If the domain registering entity is using a website hosting service, it is recommended to register as the Technical Contact a representative of the corresponding provider company. If the domain registering entity manages its own servers, it can register itself as the Technical Contact. + is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) domain_tech_contact_help: The domain name server - is a computer that saves and forwards via a general-access data communications network such data that is connected with the domain name and corresponding IP addresses. Your IT helpdesk or Internet service provider will have the necessary information about the domain name servers. + refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. account_activity: 'Account activity' account_activities: 'Account activities' receipt_date: 'Receipt date' From 039f6cf0eed28c39c8ea43532874392aca1f726f Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:14:31 +0300 Subject: [PATCH 234/247] typofix --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9fc6ed60d..2b24f8083 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -738,7 +738,7 @@ en: no_invoices_were_binded: 'No invoices were binded' domain_general_help: The Administrative Contact - is s a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) + is a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) From a20f9a1a7db057daf48ec6c463952ddd43c4f9d4 Mon Sep 17 00:00:00 2001 From: Georg Kahest Date: Fri, 1 Jul 2016 15:21:05 +0300 Subject: [PATCH 235/247] fix indention fail --- config/locales/en.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 2b24f8083..1807b3d21 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -741,10 +741,10 @@ en: is a natural person who is a legal representative of the Registrant or whom the Registrant has authorised in writing (authorised representative). The Administrative Contact does not have the right to delegate the authorisation. The Administrative Contact has the right to sign and submit Domain Name-related applications on behalf of the Registrant and to receive and forward any information pertaining to the Domain Name(s). The Administrative Contact is responsible for the correctness and genuiness of the data and documents submitted by him/her about the Registrant and about himself/herself. Registrant is obliged to guarantee that the person appointed as the Administrative Contact agrees to fulfil the duties of and Administrative Contact. There may be more than one person in this role (the registry system allows of up to 10 Administrative Contacts) domain_admin_contact_help: The Technical Contact - is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) + is a natural or legal person who, in the name of the Registrant, adds, changes or removes entries of the authoritative Name Servers for that particular domain and its DNSSEC records. The Technical Contact does not have the right to represent the Registrant in other registration services. The Registrant is obliged to guarantee that the person appointed as the Technical Contact agrees to fulfil the duties of and Technical Contact. There may be more than one person in this role (the registry system allows of up to 10 Technical Contacts) domain_tech_contact_help: The domain name server - refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. + refers to the computer that saves and forwards notices related to the Domain Names and their corresponding IP addresses in the Internet. account_activity: 'Account activity' account_activities: 'Account activities' receipt_date: 'Receipt date' From edafad5a5c365511cd5dbcaba1a20ae782274153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 5 Jul 2016 16:28:04 +0300 Subject: [PATCH 236/247] Update pending_update_notification_for_new_registrant.html.erb fix for english translation --- ...ending_update_notification_for_new_registrant.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb index 853fbafd5..a58aaef12 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.html.erb @@ -30,6 +30,8 @@ Hi,

Registrant change process for the domain <%= @params[:name] %> has been started.

+Please verify the details of the following change request. In case of problems contact your registrar <%= @params[:registrar_name] %> +

New registrant:
Name: <%= @params[:registrant_name] %>
<% if @params[:registrant_priv] %> @@ -41,7 +43,11 @@ Street: <%= @params[:registrant_street] %>
City: <%= @params[:registrant_city] %>
Country: <%= @params[:registrant_country] %>

-Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +The registrant change procedure will be completed only after the current registrant <%= @params[:old_registrant_name] %> has approved it. +

+Change request will be cancelled in case <%= @params[:old_registrant_name] %> rejects or does not approve it in <%= Setting.expire_pending_confirmation %> hours. +

+Please contact registrar <%= @params[:registrar_name] %> in case of questions. You can find the registrar's contacts at http://internet.ee/registrars.

Best Regards,
Estonian Internet Foundation From 9680ad146a2e76e43c90157a7ac3c2a3854f6b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 5 Jul 2016 16:31:22 +0300 Subject: [PATCH 237/247] Update pending_update_notification_for_new_registrant.text.erb English translation fix --- ...ending_update_notification_for_new_registrant.text.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb index fcabafd7a..9c1a6aebe 100644 --- a/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb +++ b/app/views/mailers/domain_mailer/pending_update_notification_for_new_registrant.text.erb @@ -30,6 +30,8 @@ Hi, Registrant change process for the domain <%= @params[:name] %> has been started. +Please verify the details of the following change request. In case of problems contact your registrar <%= @params[:registrar_name] %> + New registrant: Name: <%= @params[:registrant_name] %> <% if @params[:registrant_priv] %> @@ -41,7 +43,11 @@ Street: <%= @params[:registrant_street] %> City: <%= @params[:registrant_city] %> Country: <%= @params[:registrant_country] %> -Please contact to your registrar <%= @params[:registrar_name] %> if you have any questions. +The registrant change procedure will be completed only after the current registrant <%= @params[:old_registrant_name] %> has approved it. + +Change request will be cancelled in case <%= @params[:old_registrant_name] %> rejects or does not approve it in <%= Setting.expire_pending_confirmation %> hours. + +Please contact registrar <%= @params[:registrar_name] %> in case of questions. You can find the registrar's contacts at http://internet.ee/registrars. Best Regards, Estonian Internet Foundation From b013acad7cd9f7ab37904819daf5b3cccbf9de8f Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 8 Jul 2016 11:28:27 +0300 Subject: [PATCH 238/247] 108869472-filter_and_view_fixes --- app/controllers/admin/domain_versions_controller.rb | 5 ++++- app/views/admin/domain_versions/archive.haml | 2 ++ app/views/admin/domain_versions/show.haml | 8 ++++---- config/locales/en.yml | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 8812f443c..6eb47fa64 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -25,6 +25,8 @@ class Admin::DomainVersionsController < AdminController case key when 'event' whereS += " AND event = '#{value}'" + when 'name' + whereS += " AND (object->>'name' ~* '#{value}' OR object_changes->>'name' ~* '#{value}')" else whereS += create_where_string(key, value) end @@ -47,11 +49,12 @@ class Admin::DomainVersionsController < AdminController per_page = 7 @version = DomainVersion.find(params[:id]) @versions = DomainVersion.where(item_id: @version.item_id).order(id: :desc) + @versions_map = @versions.all.map(&:id) # what we do is calc amount of results until needed version # then we cacl which page it is if params[:page].blank? - counter = @versions.where("id > ?", @version.id).count + counter = @versions_map.index(@version.id) + 1 page = counter / per_page page += 1 if (counter % per_page) != 0 params[:page] = page diff --git a/app/views/admin/domain_versions/archive.haml b/app/views/admin/domain_versions/archive.haml index 2ed111083..4e06f5ccb 100644 --- a/app/views/admin/domain_versions/archive.haml +++ b/app/views/admin/domain_versions/archive.haml @@ -69,6 +69,8 @@ - if contact.nil? && ver = ContactVersion.where(item_id: domain.registrant_id).last - contact = Contact.new(ver.object.to_h.merge(ver.object_changes.to_h.each_with_object({}){|(k,v), o| o[k]=v.last } )) = contact.try(:name) + = " ".html_safe + = "(#{t(:deleted)})" %td - if domain.registrar = link_to(domain.registrar, admin_registrar_path(domain.registrar)) diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index d4dfa15f2..bd937b0c5 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -104,16 +104,16 @@ = domain.registrar.name %span{:style => "margin: 20px 20px; clear:both;"} - - if @version.previous + - if prev = @versions_map[(@versions_map.index(@version.id) - 1)] = link_to(t(:previous), - admin_domain_version_path(@version.previous.id), + admin_domain_version_path(prev), class: 'btn btn-primary') - else %a.btn.btn-primary.disabled{:href => "#"} %span= t(:previous) - - if @version.next + - if nxt = @versions_map[(@versions_map.index(@version.id) + 1)] = link_to(t(:next), - admin_domain_version_path(@version.next.id), + admin_domain_version_path(nxt), class: 'btn btn-default') - else %a.btn.btn-default.disabled{:href => "#"} diff --git a/config/locales/en.yml b/config/locales/en.yml index 400985d16..c42a4728d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -959,3 +959,4 @@ en: verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?' verified: 'Verified' only_estonian_residets_can_signin: "Access currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID." + deleted: 'Deleted' \ No newline at end of file From cfd7f600c105750cdf4e4e208557d14ceec65bf6 Mon Sep 17 00:00:00 2001 From: teadur Date: Thu, 14 Jul 2016 13:11:54 +0300 Subject: [PATCH 239/247] update to changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99534b676..1d0aaac56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +14.07.2016 +* Registry: + * whois records generation fix in contact.rb model (#117612931) + * english translation fix for pending_update_notification_for_new_registrant automated registrant message + 16.06.2016 * EPP * BUG: XML syntax error for poll and logout if optional clTRID is missing (#121580929) From d2ce612078cf6d3dc50bf0f348ce428ac298cb59 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Jul 2016 15:35:19 +0300 Subject: [PATCH 240/247] 108869472-sorting_changes --- app/controllers/admin/contact_versions_controller.rb | 7 ++++--- app/controllers/admin/domain_versions_controller.rb | 2 +- app/views/admin/contact_versions/show.haml | 12 ++++++------ app/views/admin/domain_versions/show.haml | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index dca7f8e7d..2538350be 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -30,12 +30,13 @@ class Admin::ContactVersionsController < AdminController def show per_page = 7 @version = ContactVersion.find(params[:id]) - @versions = ContactVersion.where(item_id: @version.item_id).order(id: :desc) + @versions = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc) + @versions_map = @versions.all.map(&:id) # what we do is calc amount of results until needed version # then we cacl which page it is if params[:page].blank? - counter = @versions.where("id > ?", @version.id).count + counter = @versions_map.index(@version.id) + 1 page = counter / per_page page += 1 if (counter % per_page) != 0 params[:page] = page @@ -49,7 +50,7 @@ class Admin::ContactVersionsController < AdminController end def create_where_string(key, value) - " AND object->>'#{key}' ILIKE '%#{value}%'" + " AND object->>'#{key}' ~* '#{value}'" end end diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 6eb47fa64..1ca67b33d 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -48,7 +48,7 @@ class Admin::DomainVersionsController < AdminController def show per_page = 7 @version = DomainVersion.find(params[:id]) - @versions = DomainVersion.where(item_id: @version.item_id).order(id: :desc) + @versions = DomainVersion.where(item_id: @version.item_id).order(created_at: :desc, id: :desc) @versions_map = @versions.all.map(&:id) # what we do is calc amount of results until needed version diff --git a/app/views/admin/contact_versions/show.haml b/app/views/admin/contact_versions/show.haml index dbf38dba9..fc5c48352 100644 --- a/app/views/admin/contact_versions/show.haml +++ b/app/views/admin/contact_versions/show.haml @@ -81,27 +81,27 @@ %span{:style => "padding-right:10px; float: right;"} - - if @version.previous + - if (prev = @versions_map[(@versions_map.index(@version.id) - 1)]) && @versions_map.index(@version.id) != 0 = link_to(t(:previous), - admin_contact_version_path(@version.previous.id), + admin_contact_version_path(prev), class: 'btn btn-primary') - else %a.btn.btn-primary.disabled{:href => "#"} %span= t(:previous) - - if @version.next + - if nxt = @versions_map[(@versions_map.index(@version.id) + 1)] = link_to(t(:next), - admin_contact_version_path(@version.next.id), + admin_contact_version_path(nxt), class: 'btn btn-default') - else %a.btn.btn-default.disabled{:href => "#"} %span= t(:next) .col-md-4 - .panel.panel-default{:style => "min-height:420px;"} + .panel.panel-default{:style => "min-height:450px;"} %ul.nav.nav-pills.nav-stacked - @versions.each do |vs| %li{class: (vs.id == @version.id) && :active} - = link_to admin_contact_version_path(vs.id, page: params[:page]) do + = link_to admin_contact_version_path(vs) do = l(vs.created_at, format: :short) = vs.event %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"} diff --git a/app/views/admin/domain_versions/show.haml b/app/views/admin/domain_versions/show.haml index bd937b0c5..add5920fb 100644 --- a/app/views/admin/domain_versions/show.haml +++ b/app/views/admin/domain_versions/show.haml @@ -104,7 +104,7 @@ = domain.registrar.name %span{:style => "margin: 20px 20px; clear:both;"} - - if prev = @versions_map[(@versions_map.index(@version.id) - 1)] + - if (prev = @versions_map[(@versions_map.index(@version.id) - 1)]) && @versions_map.index(@version.id) != 0 = link_to(t(:previous), admin_domain_version_path(prev), class: 'btn btn-primary') From 19e5fbdffadf709590bf3959f325b453a7041fd1 Mon Sep 17 00:00:00 2001 From: Stas Paaslane Date: Tue, 2 Aug 2016 23:05:28 +0300 Subject: [PATCH 241/247] 108869472-main_version_page_sorting --- app/controllers/admin/contact_versions_controller.rb | 2 +- app/controllers/admin/domain_versions_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/contact_versions_controller.rb b/app/controllers/admin/contact_versions_controller.rb index 2538350be..491daf083 100644 --- a/app/controllers/admin/contact_versions_controller.rb +++ b/app/controllers/admin/contact_versions_controller.rb @@ -20,7 +20,7 @@ class Admin::ContactVersionsController < AdminController end end - versions = ContactVersion.includes(:item).where(whereS) + versions = ContactVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) @q = versions.search(params[:q]) @versions = @q.result.page(params[:page]) @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 diff --git a/app/controllers/admin/domain_versions_controller.rb b/app/controllers/admin/domain_versions_controller.rb index 1ca67b33d..8e350c247 100644 --- a/app/controllers/admin/domain_versions_controller.rb +++ b/app/controllers/admin/domain_versions_controller.rb @@ -37,7 +37,7 @@ class Admin::DomainVersionsController < AdminController whereS += " AND object->>'registrar_id' IN (#{registrars.map { |r| "'#{r.id.to_s}'" }.join ','})" if registrars.present? whereS += " AND 1=0" if registrars == [] - versions = DomainVersion.includes(:item).where(whereS) + versions = DomainVersion.includes(:item).where(whereS).order(created_at: :desc, id: :desc) @q = versions.search(params[:q]) @versions = @q.result.page(params[:page]) @versions = @versions.per(params[:results_per_page]) if params[:results_per_page].to_i > 0 From f39ec22618ed89f61852ea867b31151e16882268 Mon Sep 17 00:00:00 2001 From: Stas Paaslane Date: Wed, 3 Aug 2016 19:44:04 +0300 Subject: [PATCH 242/247] 118007975-improve_dns_management --- .../registrar/domains/partials/_dnskeys.haml | 98 ++++++++++++------- 1 file changed, 61 insertions(+), 37 deletions(-) diff --git a/app/views/registrar/domains/partials/_dnskeys.haml b/app/views/registrar/domains/partials/_dnskeys.haml index 5b8a95ade..7e8e5b940 100644 --- a/app/views/registrar/domains/partials/_dnskeys.haml +++ b/app/views/registrar/domains/partials/_dnskeys.haml @@ -2,41 +2,65 @@ .panel-heading %h3.panel-title= t(:dnskeys) .panel-body{style: 'word-wrap: break-word;'} - - @data.css('dsData').each do |x| - %dl.dl-horizontal - - if x.css('digest').text.present? - %dt= t(:ds_key_tag) - %dd= x.css('keyTag').text - %dt= t(:ds_algorithm) - %dd= x.css('alg').first.text - %dt= t(:ds_digest_type) - %dd= x.css('digestType').text - %dt= t(:ds_digest) - %dd= x.css('digest').text - - @data.css('keyData').each do |x| - %dl.dl-horizontal - %dt= t(:flag) - %dd= x.css('flags').text + .table-responsive + %table.table.table-hover.table-condensed + %tbody + - @data.css('dsData').each_with_index do |x, index| + - if x.css('digest').text.present? + %tr + %td + %b= "#{t(:ds_key_tag)}:" + = x.css('keyTag').text + %tr + %td + %b= "#{t(:ds_algorithm)}:" + = x.css('alg').first.text + %tr + %td + %b= "#{t(:ds_digest_type)}:" + = x.css('digestType').text + %tr + %td + %b= "#{t(:ds_digest)}:" + = x.css('digest').text + %tr + %td + %b= "#{t(:flag)}:" + = x.css('keyData').css('flags').text + %tr + %td + %b= "#{t(:protocol)}:" + = x.css('keyData').css('protocol').text + %tr + %td + %b= "#{t(:algorithm)}:" + = x.css('alg').last.text + %tr + %td{:colspan => "3"} + %b= "#{t(:public_key)}:" + = x.css('keyData').css('pubKey').text + - if index != @data.css('keyData').size - 1 + %tr + %td{:colspan => "3"} + = " ".html_safe - %dt= t(:protocol) - %dd= x.css('protocol').text - - %dt= t(:algorithm) - %dd= x.css('alg').text - - %dt= t(:public_key) - %dd= x.css('pubKey').text - - if @data.css('dsData').empty? - %dl.dl-horizontal - - @data.css('keyData').each do |x| - %dt= t(:flag) - %dd= x.css('flags').text - - %dt= t(:protocol) - %dd= x.css('protocol').text - - %dt= t(:algorithm) - %dd= x.css('alg').text - - %dt= t(:public_key) - %dd= x.css('pubKey').text + - if @data.css('dsData').empty? + - @data.css('keyData').each_with_index do |x, index| + %tr + %td + %b= "#{t(:flag)}:" + = x.css('flags').text + %td + %b= "#{t(:protocol)}:" + = x.css('protocol').text + %td + %b= "#{t(:algorithm)}:" + = x.css('alg').text + %tr + %td{:colspan => "3"} + %b= "#{t(:public_key)}:" + = x.css('pubKey').text + - if index != @data.css('keyData').size - 1 + %tr + %td{:colspan => "3"} + = " ".html_safe \ No newline at end of file From 1182a20ba4f003cb0173a71cf78bf9c174cacff1 Mon Sep 17 00:00:00 2001 From: Stas Paaslane Date: Thu, 4 Aug 2016 19:23:18 +0300 Subject: [PATCH 243/247] 108869472-locales_merge --- config/locales/en.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index f7f4193c8..5cc0031af 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -959,4 +959,5 @@ en: verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?' verified: 'Verified' only_estonian_residets_can_signin: "Access currently available only to Estonian citizens and e-residents with Estonian ID-card or Mobile-ID." - deleted: 'Deleted' cant_match_version: 'Impossible match version with request' + deleted: 'Deleted' + cant_match_version: 'Impossible match version with request' From 0e4a03517f8b6c75f7e32e61aee95d2050bf2ff4 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 28 Jul 2016 11:36:36 +0300 Subject: [PATCH 244/247] 118822101-status_added_for_error (cherry picked from commit ef0b067) --- app/models/domain.rb | 23 ++--------------------- app/models/domain_status.rb | 23 +++++++++++++++++++++++ app/models/epp/domain.rb | 3 ++- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 3751da5b6..772fdcf40 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -656,16 +656,7 @@ class Domain < ActiveRecord::Base end def pending_update_prohibited? - (statuses_was & [ - DomainStatus::PENDING_DELETE_CONFIRMATION, - DomainStatus::CLIENT_UPDATE_PROHIBITED, - DomainStatus::SERVER_UPDATE_PROHIBITED, - DomainStatus::PENDING_CREATE, - DomainStatus::PENDING_UPDATE, - DomainStatus::PENDING_DELETE, - DomainStatus::PENDING_RENEW, - DomainStatus::PENDING_TRANSFER - ]).present? + (statuses_was & DomainStatus::UPDATE_PROHIBIT_STATES).present? end def set_pending_update @@ -689,17 +680,7 @@ class Domain < ActiveRecord::Base end def pending_delete_prohibited? - (statuses_was & [ - DomainStatus::CLIENT_DELETE_PROHIBITED, - DomainStatus::SERVER_DELETE_PROHIBITED, - DomainStatus::CLIENT_UPDATE_PROHIBITED, - DomainStatus::SERVER_UPDATE_PROHIBITED, - DomainStatus::PENDING_CREATE, - DomainStatus::PENDING_RENEW, - DomainStatus::PENDING_TRANSFER, - DomainStatus::PENDING_UPDATE, - DomainStatus::PENDING_DELETE - ]).present? + (statuses_was & DomainStatus::DELETE_PROHIBIT_STATES).present? end # let's use positive method names diff --git a/app/models/domain_status.rb b/app/models/domain_status.rb index c784a86e3..4da6a4a3c 100644 --- a/app/models/domain_status.rb +++ b/app/models/domain_status.rb @@ -95,6 +95,29 @@ class DomainStatus < ActiveRecord::Base SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED ] + UPDATE_PROHIBIT_STATES = [ + DomainStatus::PENDING_DELETE_CONFIRMATION, + DomainStatus::CLIENT_UPDATE_PROHIBITED, + DomainStatus::SERVER_UPDATE_PROHIBITED, + DomainStatus::PENDING_CREATE, + DomainStatus::PENDING_UPDATE, + DomainStatus::PENDING_DELETE, + DomainStatus::PENDING_RENEW, + DomainStatus::PENDING_TRANSFER + ] + + DELETE_PROHIBIT_STATES = [ + DomainStatus::CLIENT_DELETE_PROHIBITED, + DomainStatus::SERVER_DELETE_PROHIBITED, + DomainStatus::CLIENT_UPDATE_PROHIBITED, + DomainStatus::SERVER_UPDATE_PROHIBITED, + DomainStatus::PENDING_CREATE, + DomainStatus::PENDING_RENEW, + DomainStatus::PENDING_TRANSFER, + DomainStatus::PENDING_UPDATE, + DomainStatus::PENDING_DELETE + ] + def epp_code_map { '2302' => [ # Object exists diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index f97b1d164..b7a0b4d52 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -11,7 +11,8 @@ class Epp::Domain < Domain return if is_admin # this bad hack for 109086524, refactor later return true if is_transfer || is_renewal return unless update_prohibited? || delete_prohibited? - add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) + stat = (statuses && (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first + add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation)) false end From 436846cfe9426e2d2cad0f284853610eab1de416 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 31 Jul 2016 19:38:41 +0300 Subject: [PATCH 245/247] 118822101-builder_changes_for_array_error (cherry picked from commit e7841b5) --- app/models/nameserver.rb | 2 +- app/views/epp/error.xml.builder | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 86cd7e002..7b4daab3d 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -24,7 +24,7 @@ class Nameserver < ActiveRecord::Base def epp_code_map { '2302' => [ - [:hostname, :taken, { value: { obj: 'hostAttr', val: hostname } }] + [:hostname, :taken, { value: { obj: 'hostAttr', val: {'hostName': hostname} } }] ], '2005' => [ [:hostname, :invalid, { value: { obj: 'hostAttr', val: hostname } }], diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index 7dac4907a..fceb800b7 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -12,7 +12,13 @@ xml.epp_head do if (val = value).respond_to?(:each) val.each do |el| - xml.tag!("#{model_name}:#{x[:value][:obj]}", el, attrs) + if el.kind_of?(Array) + xml.tag!("#{model_name}:#{x[:value][:obj]}") do + xml.tag!("#{model_name}:#{el[0]}", el[1], attrs) + end + else + xml.tag!("#{model_name}:#{x[:value][:obj]}", el, attrs) + end end else xml.tag!("#{model_name}:#{x[:value][:obj]}", val, attrs) From 692de8fb0978e0f12057b01ccd11278e5ff0c6ef Mon Sep 17 00:00:00 2001 From: Stas Paaslane Date: Thu, 4 Aug 2016 16:47:08 +0300 Subject: [PATCH 246/247] 118822101-block_change (cherry picked from commit bb4f2de) --- app/models/epp/domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index b7a0b4d52..4ac84788b 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -11,7 +11,7 @@ class Epp::Domain < Domain return if is_admin # this bad hack for 109086524, refactor later return true if is_transfer || is_renewal return unless update_prohibited? || delete_prohibited? - stat = (statuses && (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first + stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation)) false end From d61a64e7bdc0a5ec29eb34378a76193c3f73242e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Tue, 9 Aug 2016 09:56:14 +0300 Subject: [PATCH 247/247] Update CHANGELOG.md --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0aaac56..73b5121b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +9.08.2016 +* Admin interface: + * actions are now clickable in domain and contact history and return the initial epp request sent to registry (117806281) + * access to archived domain and contact objects under settings (108869472) + * BUG: noaccess fixed for contacts with incomplete ident data (120093749) +* Registry: + * BUG: adding contact do a domain generated unnecessary log records (116761157) + * linked state for a contact is now dynamic (116761157) +* Portal for registrars: + * improved dnssec data presentation in ds data interface mode (118007975) + * BUG: now all the ident data is returned for contacts with incomplete set (120093749) +* EPP + * BUG: invalid error 2304 "Object status prohibits operation" (118822101) + * BUG: invalid error 2302 "Nameserver already exists on this domain" (118822101) + 14.07.2016 * Registry: * whois records generation fix in contact.rb model (#117612931)

Lugupidamisega,
- Yours Sincerely,
+ Best Regards,
С уважением,

-

Eesti Interneti SA
+

Eesti Interneti Sihtasutus
Estonian Internet Foundation