From 7a6568c34a17ce8778101b4222e64bd3ec267a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 28 Oct 2020 16:34:45 +0200 Subject: [PATCH 01/20] Update contact(s) name based on eIdentity data from Registrant API --- app/models/registrant_user.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index c0addb5cd..40f48f69c 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -2,6 +2,7 @@ class RegistrantUser < User attr_accessor :idc_data devise :trackable, :timeoutable + after_save :update_related_contacts def ability @ability ||= Ability.new(self) @@ -54,6 +55,12 @@ class RegistrantUser < User username.split.second end + def update_related_contacts + cc, idcode = registrant_ident.split('-') + contacts = Contact.where(ident: idcode, country_code: cc).where('name != ?', username) + contacts.each { |c| c.update(name: username) } + end + class << self def find_or_create_by_api_data(user_data = {}) return false unless user_data[:ident] From c72ca8d157955b3e283b13053d670b2c1ef1587b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 3 Nov 2020 14:34:55 +0200 Subject: [PATCH 02/20] Add mass actions w/ force delete to admin --- .../admin/mass_actions/force_delete.js | 3 +++ .../admin/mass_actions_controller.rb | 19 +++++++++++++++++ app/models/ability.rb | 1 + app/models/concerns/domain/force_delete.rb | 16 +++++++++++--- app/models/mass_action.rb | 21 +++++++++++++++++++ app/views/admin/base/_menu.haml | 1 + app/views/admin/mass_actions/index.html.erb | 17 +++++++++++++++ config/routes.rb | 1 + 8 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/admin/mass_actions/force_delete.js create mode 100644 app/controllers/admin/mass_actions_controller.rb create mode 100644 app/models/mass_action.rb create mode 100644 app/views/admin/mass_actions/index.html.erb diff --git a/app/assets/javascripts/admin/mass_actions/force_delete.js b/app/assets/javascripts/admin/mass_actions/force_delete.js new file mode 100644 index 000000000..62ecc1cf9 --- /dev/null +++ b/app/assets/javascripts/admin/mass_actions/force_delete.js @@ -0,0 +1,3 @@ +$('input:file').on("change", function() { + $('input:submit').prop('disabled', !$(this).val()); +}); diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb new file mode 100644 index 000000000..b342a9ef1 --- /dev/null +++ b/app/controllers/admin/mass_actions_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Admin + class MassActionsController < BaseController + authorize_resource + + # GET /admin/disputes + def index; end + + # POST /admin/disputes + def create + res = MassAction.process(params[:mass_action], params[:entry_list].path) + backlog = "#{params[:mass_action]} done for #{res[:ok].join(',')}.\n" \ + "Failed: objects: #{res[:fail].join(',')}" + + redirect_to(admin_mass_actions_path, notice: backlog) + end + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index dce8a515b..71c28e7e7 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -109,6 +109,7 @@ class Ability can :destroy, :pending can :create, :zonefile can :access, :settings_menu + can :manage, MassAction end def static_registrant diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 9b75d1e92..d62c1f9a1 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -42,12 +42,12 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength force_delete_start + Setting.expire_warning_period.days <= valid_to end - def schedule_force_delete(type: :fast_track) + def schedule_force_delete(type: :fast_track, notify: false) if discarded? raise StandardError, 'Force delete procedure cannot be scheduled while a domain is discarded' end - type == :fast_track ? force_delete_fast_track : force_delete_soft + type == :fast_track ? force_delete_fast_track : force_delete_soft(notify: notify) end def add_force_delete_type(force_delete_type) @@ -65,7 +65,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength save(validate: false) end - def force_delete_soft + def force_delete_soft(notify: false) preserve_current_statuses_for_force_delete add_force_delete_statuses add_force_delete_type(:soft) @@ -73,6 +73,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength stop_all_pending_actions allow_deletion save(validate: false) + notify_parties if notify end def clear_force_delete_data @@ -148,4 +149,13 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength def force_delete_fast_track_start_date Time.zone.today + Setting.expire_warning_period.days + Setting.redemption_grace_period.days end + + def notify_parties + self.template_name = registrant.org? ? 'legal_person' : 'private_person' + save(validate: false) + registrar.notifications.create!(text: I18n.t('force_delete_set_on_domain', + domain_name: name, + outzone_date: outzone_date, + purge_date: purge_date)) + end end diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb new file mode 100644 index 000000000..fc389be80 --- /dev/null +++ b/app/models/mass_action.rb @@ -0,0 +1,21 @@ +class MassAction + def self.process(action_type, entries) + return process_force_delete(entries) if action_type == 'force_delete' + + false + end + + def self.process_force_delete(entries) + log = { ok: [], fail: [] } + entries = CSV.read(entries, headers: true) + entries.each do |e| + dn = Domain.find_by(name_puny: e['Domain name']) + log[:fail] << e['Domain name'] and next unless dn + + dn.schedule_force_delete(type: :soft, notify: true) + log[:ok] << dn.name + end + + log + end +end diff --git a/app/views/admin/base/_menu.haml b/app/views/admin/base/_menu.haml index a327419fd..beba92716 100644 --- a/app/views/admin/base/_menu.haml +++ b/app/views/admin/base/_menu.haml @@ -33,6 +33,7 @@ %li= link_to t('.blocked_domains'), admin_blocked_domains_path %li= link_to t('.reserved_domains'), admin_reserved_domains_path %li= link_to t('.disputed_domains'), admin_disputes_path + %li= link_to t('.mass_actions'), admin_mass_actions_path %li= link_to t('.epp_log'), admin_epp_logs_path(created_after: 'today') %li= link_to t('.repp_log'), admin_repp_logs_path(created_after: 'today') %li= link_to t('.que'), '/admin/que' diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb new file mode 100644 index 000000000..192168f42 --- /dev/null +++ b/app/views/admin/mass_actions/index.html.erb @@ -0,0 +1,17 @@ + + +
+
Bulk Domain Force Delete
+
+

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain name with delete reason, separated by comma.

+

Allowed delete reasons: IDENT_BURIED | PHONE | EMAIL

+ <%= form_tag admin_mass_actions_path, multipart: true do %> + <%= file_field_tag :entry_list, accept: 'text/csv' %> + <%= hidden_field_tag :mass_action, 'force_delete' %> +
+ <%= submit_tag "Start force delete process", class: 'btn btn-danger', disabled: true %> + <% end %> +
+
diff --git a/config/routes.rb b/config/routes.rb index f58063fae..2d83cfa99 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -295,6 +295,7 @@ Rails.application.routes.draw do resources :delayed_jobs resources :epp_logs resources :repp_logs + resources :mass_actions, only: %i[index create] authenticate :admin_user do mount Que::Web, at: 'que' From f5e0e811d9599532249a4f7827cfe5dd0e3f850b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 3 Nov 2020 14:37:35 +0200 Subject: [PATCH 03/20] Revert "Update contact(s) name based on eIdentity data from Registrant API" This reverts commit 7a6568c34a17ce8778101b4222e64bd3ec267a3e. --- app/models/registrant_user.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 40f48f69c..c0addb5cd 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -2,7 +2,6 @@ class RegistrantUser < User attr_accessor :idc_data devise :trackable, :timeoutable - after_save :update_related_contacts def ability @ability ||= Ability.new(self) @@ -55,12 +54,6 @@ class RegistrantUser < User username.split.second end - def update_related_contacts - cc, idcode = registrant_ident.split('-') - contacts = Contact.where(ident: idcode, country_code: cc).where('name != ?', username) - contacts.each { |c| c.update(name: username) } - end - class << self def find_or_create_by_api_data(user_data = {}) return false unless user_data[:ident] From 2d8eb8f02cec6dde33e78631ffa0929664f6ca2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 3 Nov 2020 14:43:46 +0200 Subject: [PATCH 04/20] Make ForceDelete CSV fields snake case --- app/models/mass_action.rb | 4 ++-- app/views/admin/mass_actions/index.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index fc389be80..73c0d024d 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -9,8 +9,8 @@ class MassAction log = { ok: [], fail: [] } entries = CSV.read(entries, headers: true) entries.each do |e| - dn = Domain.find_by(name_puny: e['Domain name']) - log[:fail] << e['Domain name'] and next unless dn + dn = Domain.find_by(name_puny: e['domain_name']) + log[:fail] << e['domain_name'] and next unless dn dn.schedule_force_delete(type: :soft, notify: true) log[:ok] << dn.name diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb index 192168f42..54c108ccb 100644 --- a/app/views/admin/mass_actions/index.html.erb +++ b/app/views/admin/mass_actions/index.html.erb @@ -5,7 +5,7 @@
Bulk Domain Force Delete
-

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain name with delete reason, separated by comma.

+

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain_name (puny) followed with delete_reason, separated by comma.

Allowed delete reasons: IDENT_BURIED | PHONE | EMAIL

<%= form_tag admin_mass_actions_path, multipart: true do %> <%= file_field_tag :entry_list, accept: 'text/csv' %> From 1cca76e9ba95bed770fbde6e2b754777357aae16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 3 Nov 2020 15:46:32 +0200 Subject: [PATCH 05/20] Add reason handling to force delete bulk action --- app/controllers/admin/mass_actions_controller.rb | 8 ++++---- app/models/concerns/domain/force_delete.rb | 15 +++++++++------ app/models/mass_action.rb | 2 +- app/views/admin/mass_actions/index.html.erb | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb index b342a9ef1..a8b4ed04e 100644 --- a/app/controllers/admin/mass_actions_controller.rb +++ b/app/controllers/admin/mass_actions_controller.rb @@ -4,14 +4,14 @@ module Admin class MassActionsController < BaseController authorize_resource - # GET /admin/disputes + # GET /admin/mass_actions def index; end - # POST /admin/disputes + # POST /admin/mass_actions def create res = MassAction.process(params[:mass_action], params[:entry_list].path) - backlog = "#{params[:mass_action]} done for #{res[:ok].join(',')}.\n" \ - "Failed: objects: #{res[:fail].join(',')}" + backlog = "#{params[:mass_action]} completed for #{res[:ok]}.\n" \ + "Failed: objects: #{res[:fail]}" redirect_to(admin_mass_actions_path, notice: backlog) end diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index d62c1f9a1..6cf883c51 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -42,12 +42,12 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength force_delete_start + Setting.expire_warning_period.days <= valid_to end - def schedule_force_delete(type: :fast_track, notify: false) + def schedule_force_delete(type: :fast_track, reason: nil) if discarded? raise StandardError, 'Force delete procedure cannot be scheduled while a domain is discarded' end - type == :fast_track ? force_delete_fast_track : force_delete_soft(notify: notify) + type == :fast_track ? force_delete_fast_track : force_delete_soft(reason: reason) end def add_force_delete_type(force_delete_type) @@ -65,7 +65,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength save(validate: false) end - def force_delete_soft(notify: false) + def force_delete_soft(reason: nil) preserve_current_statuses_for_force_delete add_force_delete_statuses add_force_delete_type(:soft) @@ -73,7 +73,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength stop_all_pending_actions allow_deletion save(validate: false) - notify_parties if notify + notify_parties(reason) if reason end def clear_force_delete_data @@ -150,8 +150,11 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength Time.zone.today + Setting.expire_warning_period.days + Setting.redemption_grace_period.days end - def notify_parties - self.template_name = registrant.org? ? 'legal_person' : 'private_person' + def notify_parties(reason) + ent = registrant.org? ? 'legal_person' : 'private_person' if reason == 'ENTITY_BURIED' + ent ||= reason.downcase + self.template_name = ent + save(validate: false) registrar.notifications.create!(text: I18n.t('force_delete_set_on_domain', domain_name: name, diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index 73c0d024d..e0ad113a4 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -12,7 +12,7 @@ class MassAction dn = Domain.find_by(name_puny: e['domain_name']) log[:fail] << e['domain_name'] and next unless dn - dn.schedule_force_delete(type: :soft, notify: true) + dn.schedule_force_delete(type: :soft, reason: e['delete_reason']) log[:ok] << dn.name end diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb index 54c108ccb..4e500f86b 100644 --- a/app/views/admin/mass_actions/index.html.erb +++ b/app/views/admin/mass_actions/index.html.erb @@ -6,7 +6,7 @@
Bulk Domain Force Delete

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain_name (puny) followed with delete_reason, separated by comma.

-

Allowed delete reasons: IDENT_BURIED | PHONE | EMAIL

+

Allowed delete reasons: ENTITY_BURIED | PHONE | EMAIL

<%= form_tag admin_mass_actions_path, multipart: true do %> <%= file_field_tag :entry_list, accept: 'text/csv' %> <%= hidden_field_tag :mass_action, 'force_delete' %> From 4566b39435cd54dce8e4fcfbe8ff12c57b1047d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 4 Nov 2020 13:48:22 +0200 Subject: [PATCH 06/20] Add missing translations --- config/locales/admin/menu.en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/admin/menu.en.yml b/config/locales/admin/menu.en.yml index 617341c6a..1de875662 100644 --- a/config/locales/admin/menu.en.yml +++ b/config/locales/admin/menu.en.yml @@ -14,6 +14,7 @@ en: blocked_domains: Blocked domains reserved_domains: Reserved domains disputed_domains: Disputed domains + mass_actions: Mass actions epp_log: EPP log repp_log: REPP log que: Que From 4e1854510530b069225e77520a925f7c3333571d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 4 Nov 2020 16:30:54 +0200 Subject: [PATCH 07/20] Add CSV validator to mass action --- .../admin/mass_actions_controller.rb | 10 ++++++--- app/models/mass_action.rb | 22 +++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb index a8b4ed04e..9c83e4978 100644 --- a/app/controllers/admin/mass_actions_controller.rb +++ b/app/controllers/admin/mass_actions_controller.rb @@ -10,10 +10,14 @@ module Admin # POST /admin/mass_actions def create res = MassAction.process(params[:mass_action], params[:entry_list].path) - backlog = "#{params[:mass_action]} completed for #{res[:ok]}.\n" \ - "Failed: objects: #{res[:fail]}" + notice = if res + "#{params[:mass_action]} completed for #{res[:ok]}.\n" \ + "Failed: objects: #{res[:fail]}" + else + "Dataset integrity validation failed for #{params[:mass_action]}" + end - redirect_to(admin_mass_actions_path, notice: backlog) + redirect_to(admin_mass_actions_path, notice: notice) end end end diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index e0ad113a4..6d988bf2b 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -1,13 +1,18 @@ class MassAction def self.process(action_type, entries) - return process_force_delete(entries) if action_type == 'force_delete' + entries = CSV.read(entries, headers: true) + case action_type + when 'force_delete' + return false unless force_delete_entries_valid?(entries) + process_force_delete(entries) + end + rescue StandardError false end def self.process_force_delete(entries) log = { ok: [], fail: [] } - entries = CSV.read(entries, headers: true) entries.each do |e| dn = Domain.find_by(name_puny: e['domain_name']) log[:fail] << e['domain_name'] and next unless dn @@ -18,4 +23,17 @@ class MassAction log end + + def self.force_delete_entries_valid?(entries) + valid = true + entries.each do |e| + unless e['domain_name'].present? && %w[IDENT_BURIED EMAIL PHONE].include?(e['delete_reason']) + valid = false + end + end + + valid + rescue StandardError + false + end end From de5b85b11500970cbbf732b7cc66ec36a9303fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 4 Nov 2020 16:45:32 +0200 Subject: [PATCH 08/20] Use notification_template to determine org/priv liquidation template --- app/models/concerns/domain/force_delete.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 4f4055185..a2234ca2b 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -155,7 +155,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end def notify_parties(reason) - ent = registrant.org? ? 'legal_person' : 'private_person' if reason == 'ENTITY_BURIED' + ent = notification_template if reason == 'ENTITY_BURIED' ent ||= reason.downcase self.template_name = ent From d80007d83ccc49cb026ad10969793bb5eda08871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 4 Nov 2020 17:04:12 +0200 Subject: [PATCH 09/20] Make mass action less complicated --- app/models/mass_action.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index 6d988bf2b..ab8b8ed4b 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -1,17 +1,20 @@ class MassAction def self.process(action_type, entries) entries = CSV.read(entries, headers: true) - case action_type - when 'force_delete' - return false unless force_delete_entries_valid?(entries) + return process_force_delete(entries) if action_type == 'force_delete' - process_force_delete(entries) - end + false rescue StandardError false end def self.process_force_delete(entries) + return false unless force_delete_entries_valid?(entries) + + apply_force_deletes(entries) + end + + def self.apply_force_deletes(entries) log = { ok: [], fail: [] } entries.each do |e| dn = Domain.find_by(name_puny: e['domain_name']) @@ -25,15 +28,11 @@ class MassAction end def self.force_delete_entries_valid?(entries) - valid = true entries.each do |e| - unless e['domain_name'].present? && %w[IDENT_BURIED EMAIL PHONE].include?(e['delete_reason']) - valid = false - end + reasons = %w[IDENT_BURIED EMAIL PHONE] + return false unless e['domain_name'].present? && reasons.include?(e['delete_reason']) end - valid - rescue StandardError - false + true end end From 1a0becf7859e6aaa439ce01290f4aaa267d76293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 5 Nov 2020 14:16:37 +0200 Subject: [PATCH 10/20] Test mass actions in admin --- .../admin/mass_actions/force_delete.js | 3 --- .../admin/mass_actions_controller.rb | 9 ++++++-- app/models/ability.rb | 2 +- app/views/admin/mass_actions/index.html.erb | 8 ++++--- .../files/invalid_mass_force_delete_list.csv | 2 ++ .../files/valid_mass_force_delete_list.csv | 2 ++ .../mass_actions/mass_force_delete_test.rb | 23 +++++++++++++++++++ 7 files changed, 40 insertions(+), 9 deletions(-) delete mode 100644 app/assets/javascripts/admin/mass_actions/force_delete.js create mode 100644 test/fixtures/files/invalid_mass_force_delete_list.csv create mode 100644 test/fixtures/files/valid_mass_force_delete_list.csv create mode 100644 test/system/admin_area/mass_actions/mass_force_delete_test.rb diff --git a/app/assets/javascripts/admin/mass_actions/force_delete.js b/app/assets/javascripts/admin/mass_actions/force_delete.js deleted file mode 100644 index 62ecc1cf9..000000000 --- a/app/assets/javascripts/admin/mass_actions/force_delete.js +++ /dev/null @@ -1,3 +0,0 @@ -$('input:file').on("change", function() { - $('input:submit').prop('disabled', !$(this).val()); -}); diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb index 9c83e4978..d22568155 100644 --- a/app/controllers/admin/mass_actions_controller.rb +++ b/app/controllers/admin/mass_actions_controller.rb @@ -2,10 +2,11 @@ module Admin class MassActionsController < BaseController - authorize_resource + before_action :authorize_admin # GET /admin/mass_actions - def index; end + def index + end # POST /admin/mass_actions def create @@ -19,5 +20,9 @@ module Admin redirect_to(admin_mass_actions_path, notice: notice) end + + def authorize_admin + authorize! :manage, :mass_actions + end end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 71c28e7e7..5772e1f1d 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -109,7 +109,7 @@ class Ability can :destroy, :pending can :create, :zonefile can :access, :settings_menu - can :manage, MassAction + can :manage, :mass_actions end def static_registrant diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb index 4e500f86b..9af6a240f 100644 --- a/app/views/admin/mass_actions/index.html.erb +++ b/app/views/admin/mass_actions/index.html.erb @@ -7,11 +7,13 @@

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain_name (puny) followed with delete_reason, separated by comma.

Allowed delete reasons: ENTITY_BURIED | PHONE | EMAIL

- <%= form_tag admin_mass_actions_path, multipart: true do %> - <%= file_field_tag :entry_list, accept: 'text/csv' %> + <%= form_tag admin_mass_actions_path, multipart: true, method: :post do %> + <%= label_tag :entry_list %> + <%= file_field_tag :entry_list, required: true, accept: 'text/csv' %> <%= hidden_field_tag :mass_action, 'force_delete' %> + <%= hidden_field_tag :authenticity_token, form_authenticity_token %>
- <%= submit_tag "Start force delete process", class: 'btn btn-danger', disabled: true %> + <%= submit_tag "Start force delete process", class: 'btn btn-danger', id: 'fd_submit' %> <% end %>
diff --git a/test/fixtures/files/invalid_mass_force_delete_list.csv b/test/fixtures/files/invalid_mass_force_delete_list.csv new file mode 100644 index 000000000..2b153874b --- /dev/null +++ b/test/fixtures/files/invalid_mass_force_delete_list.csv @@ -0,0 +1,2 @@ +domain_name, delete_reason +sh\á;[]c' diff --git a/test/fixtures/files/valid_mass_force_delete_list.csv b/test/fixtures/files/valid_mass_force_delete_list.csv new file mode 100644 index 000000000..08ded84cd --- /dev/null +++ b/test/fixtures/files/valid_mass_force_delete_list.csv @@ -0,0 +1,2 @@ +domain_name, delete_reason +shop.test,ENTITY_BURIED diff --git a/test/system/admin_area/mass_actions/mass_force_delete_test.rb b/test/system/admin_area/mass_actions/mass_force_delete_test.rb new file mode 100644 index 000000000..7b4688b32 --- /dev/null +++ b/test/system/admin_area/mass_actions/mass_force_delete_test.rb @@ -0,0 +1,23 @@ +require 'application_system_test_case' +require 'test_helper' + +class AdminAreaMassActionsForceDeleteTest < ApplicationSystemTestCase + def setup + sign_in users(:admin) + end + + def test_processes_uploaded_valid_csv + visit admin_mass_actions_path + + attach_file('entry_list', Rails.root.join('test', 'fixtures', 'files', 'valid_mass_force_delete_list.csv').to_s) + click_link_or_button 'Start force delete process' + assert_text 'force_delete completed for ["shop.test"]. Failed: objects: []' + end + + def test_processes_uploaded_invalid_csv + visit admin_mass_actions_path + attach_file(:entry_list, Rails.root.join('test', 'fixtures', 'files', 'invalid_mass_force_delete_list.csv').to_s) + click_link_or_button 'Start force delete process' + assert_text 'Dataset integrity validation failed for force_delete' + end +end From b61fe5f7b4709e77c9bf665aad1a913baa4584b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 5 Nov 2020 14:46:06 +0200 Subject: [PATCH 11/20] Fix CC issues --- app/controllers/admin/mass_actions_controller.rb | 3 +-- test/fixtures/files/invalid_mass_force_delete_list.csv | 2 +- test/fixtures/files/valid_mass_force_delete_list.csv | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb index d22568155..faa810ee0 100644 --- a/app/controllers/admin/mass_actions_controller.rb +++ b/app/controllers/admin/mass_actions_controller.rb @@ -5,8 +5,7 @@ module Admin before_action :authorize_admin # GET /admin/mass_actions - def index - end + def index; end # POST /admin/mass_actions def create diff --git a/test/fixtures/files/invalid_mass_force_delete_list.csv b/test/fixtures/files/invalid_mass_force_delete_list.csv index 2b153874b..ef5e4c0e3 100644 --- a/test/fixtures/files/invalid_mass_force_delete_list.csv +++ b/test/fixtures/files/invalid_mass_force_delete_list.csv @@ -1,2 +1,2 @@ -domain_name, delete_reason +domain_name,delete_reason sh\á;[]c' diff --git a/test/fixtures/files/valid_mass_force_delete_list.csv b/test/fixtures/files/valid_mass_force_delete_list.csv index 08ded84cd..81f5bcf2c 100644 --- a/test/fixtures/files/valid_mass_force_delete_list.csv +++ b/test/fixtures/files/valid_mass_force_delete_list.csv @@ -1,2 +1,2 @@ -domain_name, delete_reason +domain_name,delete_reason shop.test,ENTITY_BURIED From cfa44f7692e46d29eed60e4586c919b0bc5ff398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 5 Nov 2020 15:37:28 +0200 Subject: [PATCH 12/20] Improve mass action tests --- app/controllers/admin/mass_actions_controller.rb | 2 +- app/models/mass_action.rb | 8 ++++---- .../invalid_mass_force_delete_list.csv | 0 .../mass_actions/valid_mass_force_delete_list.csv | 5 +++++ test/fixtures/files/valid_mass_force_delete_list.csv | 2 -- .../admin_area/mass_actions/mass_force_delete_test.rb | 11 ++++++++--- 6 files changed, 18 insertions(+), 10 deletions(-) rename test/fixtures/files/{ => mass_actions}/invalid_mass_force_delete_list.csv (100%) create mode 100644 test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv delete mode 100644 test/fixtures/files/valid_mass_force_delete_list.csv diff --git a/app/controllers/admin/mass_actions_controller.rb b/app/controllers/admin/mass_actions_controller.rb index faa810ee0..bc3491faf 100644 --- a/app/controllers/admin/mass_actions_controller.rb +++ b/app/controllers/admin/mass_actions_controller.rb @@ -12,7 +12,7 @@ module Admin res = MassAction.process(params[:mass_action], params[:entry_list].path) notice = if res "#{params[:mass_action]} completed for #{res[:ok]}.\n" \ - "Failed: objects: #{res[:fail]}" + "Failed: #{res[:fail]}" else "Dataset integrity validation failed for #{params[:mass_action]}" end diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index ab8b8ed4b..44e0dcc47 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -1,9 +1,9 @@ class MassAction def self.process(action_type, entries) - entries = CSV.read(entries, headers: true) - return process_force_delete(entries) if action_type == 'force_delete' + return false unless %w[force_delete].include?(action_type) - false + entries = CSV.read(entries, headers: true) + process_force_delete(entries) if action_type == force_delete rescue StandardError false end @@ -29,7 +29,7 @@ class MassAction def self.force_delete_entries_valid?(entries) entries.each do |e| - reasons = %w[IDENT_BURIED EMAIL PHONE] + reasons = %w[ENTITY_BURIED EMAIL PHONE] return false unless e['domain_name'].present? && reasons.include?(e['delete_reason']) end diff --git a/test/fixtures/files/invalid_mass_force_delete_list.csv b/test/fixtures/files/mass_actions/invalid_mass_force_delete_list.csv similarity index 100% rename from test/fixtures/files/invalid_mass_force_delete_list.csv rename to test/fixtures/files/mass_actions/invalid_mass_force_delete_list.csv diff --git a/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv b/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv new file mode 100644 index 000000000..3d8af84bd --- /dev/null +++ b/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv @@ -0,0 +1,5 @@ +domain_name,delete_reason +shop.test,ENTITY_BURIED +airport.test,PHONE +library.test,EMAIL +nonexistant.test,ENTITY_BURIED diff --git a/test/fixtures/files/valid_mass_force_delete_list.csv b/test/fixtures/files/valid_mass_force_delete_list.csv deleted file mode 100644 index 81f5bcf2c..000000000 --- a/test/fixtures/files/valid_mass_force_delete_list.csv +++ /dev/null @@ -1,2 +0,0 @@ -domain_name,delete_reason -shop.test,ENTITY_BURIED diff --git a/test/system/admin_area/mass_actions/mass_force_delete_test.rb b/test/system/admin_area/mass_actions/mass_force_delete_test.rb index 7b4688b32..57776e49f 100644 --- a/test/system/admin_area/mass_actions/mass_force_delete_test.rb +++ b/test/system/admin_area/mass_actions/mass_force_delete_test.rb @@ -9,15 +9,20 @@ class AdminAreaMassActionsForceDeleteTest < ApplicationSystemTestCase def test_processes_uploaded_valid_csv visit admin_mass_actions_path - attach_file('entry_list', Rails.root.join('test', 'fixtures', 'files', 'valid_mass_force_delete_list.csv').to_s) + attach_file('entry_list', Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'valid_mass_force_delete_list.csv').to_s) click_link_or_button 'Start force delete process' - assert_text 'force_delete completed for ["shop.test"]. Failed: objects: []' + assert_text 'force_delete completed for ["shop.test", "airport.test", "library.test"]. Failed: ["nonexistant.test"]' end def test_processes_uploaded_invalid_csv visit admin_mass_actions_path - attach_file(:entry_list, Rails.root.join('test', 'fixtures', 'files', 'invalid_mass_force_delete_list.csv').to_s) + + attach_file(:entry_list, Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'invalid_mass_force_delete_list.csv').to_s) click_link_or_button 'Start force delete process' assert_text 'Dataset integrity validation failed for force_delete' end + +def test_logs_failed_domains_to_response + +end end From e568369e36e9944beafab7dc3b45dce3f17a9fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 5 Nov 2020 15:51:20 +0200 Subject: [PATCH 13/20] Clean up --- app/models/concerns/domain/force_delete.rb | 2 +- app/models/mass_action.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 05e1c5d5b..04689e01a 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -155,7 +155,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end def notify_parties(reason) - ent = notification_template if reason == 'ENTITY_BURIED' + ent = notification_template if %w[ENTITY_BURIED EMAIL].include? reason ent ||= reason.downcase self.template_name = ent diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index 44e0dcc47..dbb6873c6 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -1,9 +1,12 @@ class MassAction def self.process(action_type, entries) - return false unless %w[force_delete].include?(action_type) - entries = CSV.read(entries, headers: true) - process_force_delete(entries) if action_type == force_delete + case action_type + when 'force_delete' + process_force_delete(entries) + else + false + end rescue StandardError false end From 7bf31995d3a36147d721ee46b24bf3c04321a489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 5 Nov 2020 15:51:20 +0200 Subject: [PATCH 14/20] Clean up --- app/models/concerns/domain/force_delete.rb | 2 +- app/models/mass_action.rb | 9 ++++++--- .../admin_area/mass_actions/mass_force_delete_test.rb | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 05e1c5d5b..04689e01a 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -155,7 +155,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end def notify_parties(reason) - ent = notification_template if reason == 'ENTITY_BURIED' + ent = notification_template if %w[ENTITY_BURIED EMAIL].include? reason ent ||= reason.downcase self.template_name = ent diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index 44e0dcc47..dbb6873c6 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -1,9 +1,12 @@ class MassAction def self.process(action_type, entries) - return false unless %w[force_delete].include?(action_type) - entries = CSV.read(entries, headers: true) - process_force_delete(entries) if action_type == force_delete + case action_type + when 'force_delete' + process_force_delete(entries) + else + false + end rescue StandardError false end diff --git a/test/system/admin_area/mass_actions/mass_force_delete_test.rb b/test/system/admin_area/mass_actions/mass_force_delete_test.rb index 57776e49f..d188b35fd 100644 --- a/test/system/admin_area/mass_actions/mass_force_delete_test.rb +++ b/test/system/admin_area/mass_actions/mass_force_delete_test.rb @@ -21,8 +21,4 @@ class AdminAreaMassActionsForceDeleteTest < ApplicationSystemTestCase click_link_or_button 'Start force delete process' assert_text 'Dataset integrity validation failed for force_delete' end - -def test_logs_failed_domains_to_response - -end end From 61886f436b86703a67b0bda73d7501b9c0b6738c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 13 Nov 2020 15:41:21 +0200 Subject: [PATCH 15/20] Comment future implementations --- app/models/concerns/domain/force_delete.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 04689e01a..735a63edf 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -154,9 +154,11 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength Time.zone.today + Setting.expire_warning_period.days + Setting.redemption_grace_period.days end - def notify_parties(reason) - ent = notification_template if %w[ENTITY_BURIED EMAIL].include? reason - ent ||= reason.downcase + # Uncomment when we have template for phone / email as well + def notify_parties(_reason) + ent = notification_template + # if %w[ENTITY_BURIED EMAIL].include? reason + # ent ||= reason.downcase self.template_name = ent save(validate: false) From 38cefe725542733992764021d2e84f1f9b337bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 28 Dec 2020 12:41:07 +0200 Subject: [PATCH 16/20] Allow explicit reason for force delete mail template --- app/interactions/domains/force_delete/base.rb | 3 +++ app/interactions/domains/force_delete/notify_by_email.rb | 2 +- app/models/concerns/domain/force_delete.rb | 5 ++++- app/models/mass_action.rb | 5 +++-- .../files/mass_actions/valid_mass_force_delete_list.csv | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/interactions/domains/force_delete/base.rb b/app/interactions/domains/force_delete/base.rb index 27601c1d2..d4ad2b820 100644 --- a/app/interactions/domains/force_delete/base.rb +++ b/app/interactions/domains/force_delete/base.rb @@ -10,6 +10,9 @@ module Domains boolean :notify_by_email, default: false, description: 'Do we need to send email notification' + string :reason, + default: nil, + description: 'Which mail template to use explicitly' validates :type, inclusion: { in: %i[fast_track soft] } end diff --git a/app/interactions/domains/force_delete/notify_by_email.rb b/app/interactions/domains/force_delete/notify_by_email.rb index b60f54a5e..e512657b0 100644 --- a/app/interactions/domains/force_delete/notify_by_email.rb +++ b/app/interactions/domains/force_delete/notify_by_email.rb @@ -8,7 +8,7 @@ module Domains send_email domain.update(contact_notification_sent_date: Time.zone.today) else - domain.update(template_name: domain.notification_template) + domain.update(template_name: domain.notification_template(explicit: reason)) end end diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index e06da25cc..74950682e 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -19,7 +19,10 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end end - def notification_template + def notification_template(explicit: nil) + reason = explicit&.downcase + return reason if %w[invalid_email invalid_phone].include?(reason) + if contact_emails_verification_failed.present? 'invalid_email' elsif registrant.org? diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index dbb6873c6..08a0fea2f 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -23,7 +23,8 @@ class MassAction dn = Domain.find_by(name_puny: e['domain_name']) log[:fail] << e['domain_name'] and next unless dn - dn.schedule_force_delete(type: :soft, reason: e['delete_reason']) + dn.schedule_force_delete(type: :soft, notify_by_email: false, reason: e['delete_reason']) + log[:ok] << dn.name end @@ -32,7 +33,7 @@ class MassAction def self.force_delete_entries_valid?(entries) entries.each do |e| - reasons = %w[ENTITY_BURIED EMAIL PHONE] + reasons = %w[ENTITY_BURIED INVALID_EMAIL INVALID_PHONE] return false unless e['domain_name'].present? && reasons.include?(e['delete_reason']) end diff --git a/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv b/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv index 3d8af84bd..ba88abeb4 100644 --- a/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv +++ b/test/fixtures/files/mass_actions/valid_mass_force_delete_list.csv @@ -1,5 +1,5 @@ domain_name,delete_reason shop.test,ENTITY_BURIED -airport.test,PHONE -library.test,EMAIL +airport.test,INVALID_PHONE +library.test,INVALID_EMAIL nonexistant.test,ENTITY_BURIED From 4ccb71287dd3219390c8d7c9892c7872e42a8fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 28 Dec 2020 13:23:04 +0200 Subject: [PATCH 17/20] Add invalid phone mail template to force delete mailer --- app/models/concerns/domain/force_delete.rb | 5 +- app/models/mass_action.rb | 2 + app/views/admin/mass_actions/index.html.erb | 2 +- .../forced/invalid_phone.html.erb | 47 +++++++++++++++++++ .../forced/invalid_phone.text.erb | 47 +++++++++++++++++++ 5 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb create mode 100644 app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 74950682e..87e9a957b 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -36,9 +36,8 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength statuses.include?(DomainStatus::FORCE_DELETE) end - def schedule_force_delete(type: :fast_track, notify_by_email: false) - Domains::ForceDelete::SetForceDelete.run(domain: self, - type: type, + def schedule_force_delete(type: :fast_track, notify_by_email: false, reason: nil) + Domains::ForceDelete::SetForceDelete.run(domain: self, type: type, reason: reason, notify_by_email: notify_by_email) end diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index 08a0fea2f..eac94fd56 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -14,6 +14,7 @@ class MassAction def self.process_force_delete(entries) return false unless force_delete_entries_valid?(entries) + STDOUT << 'PASSSß' apply_force_deletes(entries) end @@ -26,6 +27,7 @@ class MassAction dn.schedule_force_delete(type: :soft, notify_by_email: false, reason: e['delete_reason']) log[:ok] << dn.name + STDOUT << 'OOOOK' end log diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb index 9af6a240f..6d6ee5eb4 100644 --- a/app/views/admin/mass_actions/index.html.erb +++ b/app/views/admin/mass_actions/index.html.erb @@ -6,7 +6,7 @@
Bulk Domain Force Delete

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain_name (puny) followed with delete_reason, separated by comma.

-

Allowed delete reasons: ENTITY_BURIED | PHONE | EMAIL

+

Allowed delete reasons: ENTITY_BURIED | INVALID_PHONE | INVALID_EMAIL

<%= form_tag admin_mass_actions_path, multipart: true, method: :post do %> <%= label_tag :entry_list %> <%= file_field_tag :entry_list, required: true, accept: 'text/csv' %> diff --git a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb new file mode 100644 index 000000000..a73492efb --- /dev/null +++ b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb @@ -0,0 +1,47 @@ +

Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt

+ +

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontaktandmed on puudulikud - telefoni number <%= @domain.registrant.phone %>.

+ +

Et see olukord on vastuolus .ee domeenireeglitega algatas EIS <%= @delete_period_length %> päeva pikkuse kustutusmenetluse. Menetluse käigus on domeen <%= @expire_warning_period %> esimest päeva internetis kättesaadav.

+ +

Andmete parandamiseks pöörduge palun oma registripidaja <%= @registrar.name %> poole või isiklike ja oma ettevõtte andmete puhul registreerija portaali.

+ +

Kui kontaktandmed ei ole <%= @delete_period_length %> päeva jooksul parandatud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.

+ +

Lisaküsimuste korral võtke palun ühendust oma registripidajaga:

+<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %> + +<%= render 'mailers/shared/signatures/signature.et.html' %> + +
+ +

Dear registrant/administrative contact of .ee domain,

+ +

Estonian Internet Foundation has learned that contact data of the domain <%= @domain.name %> is invalid - phone <%= @domain.registrant.phone %>.

+ +

Since this is a violation of Estonian domain regulations, <%= @delete_period_length %>-day deletion process has started for the <%= @domain.name %> domain. For the first <%= @expire_warning_period %> days the domain will remain available on the Internet during the deletion process.

+ +

Please, contact your registrar <%= @registrar.name %> with updated contact data, or in case of your personal or business data use .ee portal for registrants

+ +

If the data is not fixed within <%= @delete_period_length %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction environment. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.

+ +

Should you have additional questions, please contact your registrar:

+<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %> + +<%= render 'mailers/shared/signatures/signature.en.html' %> +
+ +

Уважаемый регистрант/административный контакт домена .ee

+ +

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонный номер <%= @domain.registrant.phone %>.

+ +

Так как это является нарушением Правил домена .ee, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.

+ +

Для уточнения контактных данных, пожалуйста, свяжитесь с регистратором <%= @registrar.name %>, либо воспользуйтесь порталом для регистрантов

+ +

Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в аукционной среде.ee. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.

+ +

В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором: +<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>

+ +<%= render 'mailers/shared/signatures/signature.ru.html' %> diff --git a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb new file mode 100644 index 000000000..2779e596d --- /dev/null +++ b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb @@ -0,0 +1,47 @@ +

Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt

+ +

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontaktandmed on puudulikud - telefoninumber <%= @domain.registrant.phone %>

+ +

Et see olukord on vastuolus .ee domeenireeglitega algatas EIS <%= @delete_period_length %> päeva pikkuse kustutusmenetluse. Menetluse käigus on domeen <%= @expire_warning_period %> esimest päeva internetis kättesaadav.

+ +

Andmete parandamiseks pöörduge palun oma registripidaja <%= @registrar.name %> poole või isiklike ja oma ettevõtte andmete puhul registreerija portaali.

+ +

Kui kontaktandmed ei ole <%= @delete_period_length %> päeva jooksul parandatud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.

+ +

Lisaküsimuste korral võtke palun ühendust oma registripidajaga:

+<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %> + +<%= render 'mailers/shared/signatures/signature.et.html' %> + +
+ +

Dear registrant/administrative contact of .ee domain,

+ +

Estonian Internet Foundation has learned that contact data of the domain <%= @domain.name %> s invalid - phone number <%= @domain.registrant.phone %>.

+ +

Since this is a violation of Estonian domain regulations, <%= @delete_period_length %>-day deletion process has started for the <%= @domain.name %> domain. For the first <%= @expire_warning_period %> days the domain will remain available on the Internet during the deletion process.

+ +

Please, contact your registrar <%= @registrar.name %> with updated contact data, or in case of your personal or business data use .ee portal for registrants

+ +

If the data is not fixed within <%= @delete_period_length %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction environment. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.

+ +

Should you have additional questions, please contact your registrar:

+<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %> + +<%= render 'mailers/shared/signatures/signature.en.html' %> +
+ +

Уважаемый регистрант/административный контакт домена .ee

+ +

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонный номер <%= @domain.registrant.phone %>.

+ +

Так как это является нарушением Правил домена .ee, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.

+ +

Для уточнения контактных данных, пожалуйста, свяжитесь с регистратором <%= @registrar.name %>, либо воспользуйтесь порталом для регистрантов

+ +

Если контактные данные не будут исправлены в течение <%= @delete_period_length %> дней, домен <%= @domain.name %> отправится <%= @domain.force_delete_date %> на доменный аукцион в аукционной среде.ee. Если в течение 24 часов в отношении домена <%= @domain.name %> е поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.

+ +

В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором: + <%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>

+ +<%= render 'mailers/shared/signatures/signature.ru.html' %> From 980e5be7fc3614ace0510e0508e4c28d127a4e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 28 Dec 2020 14:21:39 +0200 Subject: [PATCH 18/20] Improve wording for invalid phone mail templates --- .../domain_delete_mailer/forced/invalid_phone.html.erb | 6 +++--- .../domain_delete_mailer/forced/invalid_phone.text.erb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb index a73492efb..746a0e256 100644 --- a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb +++ b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.html.erb @@ -1,6 +1,6 @@

Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt

-

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontaktandmed on puudulikud - telefoni number <%= @domain.registrant.phone %>.

+

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontakti(de) telefoni number või numbrid on puudulikud.

Et see olukord on vastuolus .ee domeenireeglitega algatas EIS <%= @delete_period_length %> päeva pikkuse kustutusmenetluse. Menetluse käigus on domeen <%= @expire_warning_period %> esimest päeva internetis kättesaadav.

@@ -17,7 +17,7 @@

Dear registrant/administrative contact of .ee domain,

-

Estonian Internet Foundation has learned that contact data of the domain <%= @domain.name %> is invalid - phone <%= @domain.registrant.phone %>.

+

Estonian Internet Foundation has learned that contact(s) phone number data of the domain <%= @domain.name %> are invalid.

Since this is a violation of Estonian domain regulations, <%= @delete_period_length %>-day deletion process has started for the <%= @domain.name %> domain. For the first <%= @expire_warning_period %> days the domain will remain available on the Internet during the deletion process.

@@ -33,7 +33,7 @@

Уважаемый регистрант/административный контакт домена .ee

-

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонный номер <%= @domain.registrant.phone %>.

+

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонные номера.

Так как это является нарушением Правил домена .ee, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.

diff --git a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb index 2779e596d..fe61b44d1 100644 --- a/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb +++ b/app/views/mailers/domain_delete_mailer/forced/invalid_phone.text.erb @@ -1,6 +1,6 @@

Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt

-

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontaktandmed on puudulikud - telefoninumber <%= @domain.registrant.phone %>

+

Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et domeeni <%= @domain.name %> kontakti(de) telefoni number või numbrid on puudulikud.

Et see olukord on vastuolus .ee domeenireeglitega algatas EIS <%= @delete_period_length %> päeva pikkuse kustutusmenetluse. Menetluse käigus on domeen <%= @expire_warning_period %> esimest päeva internetis kättesaadav.

@@ -17,7 +17,7 @@

Dear registrant/administrative contact of .ee domain,

-

Estonian Internet Foundation has learned that contact data of the domain <%= @domain.name %> s invalid - phone number <%= @domain.registrant.phone %>.

+

Estonian Internet Foundation has learned that contact(s) phone number data of the domain <%= @domain.name %> are invalid.

Since this is a violation of Estonian domain regulations, <%= @delete_period_length %>-day deletion process has started for the <%= @domain.name %> domain. For the first <%= @expire_warning_period %> days the domain will remain available on the Internet during the deletion process.

@@ -33,7 +33,7 @@

Уважаемый регистрант/административный контакт домена .ee

-

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонный номер <%= @domain.registrant.phone %>.

+

Целевому учреждению Eesti Internet (EIS) стало известно, что контактные данные домена <%= @domain.name %> неверны - телефонные номера.

Так как это является нарушением Правил домена .ee, <%= @delete_period_length %>-дневный процесс удаления начат для доменного имени <%= @domain.name %>. В течение первых <%= @expire_warning_period %> дней домен будет доступен в интернете.

From 51d455e619a6401e1343431efcedf5aa067b6f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 30 Dec 2020 15:52:25 +0200 Subject: [PATCH 19/20] Fix FD mail template assign in bulk FD --- app/models/mass_action.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/mass_action.rb b/app/models/mass_action.rb index eac94fd56..c9cc1fe14 100644 --- a/app/models/mass_action.rb +++ b/app/models/mass_action.rb @@ -14,7 +14,6 @@ class MassAction def self.process_force_delete(entries) return false unless force_delete_entries_valid?(entries) - STDOUT << 'PASSSß' apply_force_deletes(entries) end @@ -24,10 +23,9 @@ class MassAction dn = Domain.find_by(name_puny: e['domain_name']) log[:fail] << e['domain_name'] and next unless dn - dn.schedule_force_delete(type: :soft, notify_by_email: false, reason: e['delete_reason']) + dn.schedule_force_delete(type: :soft, notify_by_email: true, reason: e['delete_reason']) log[:ok] << dn.name - STDOUT << 'OOOOK' end log From 3e708fa014c818c4b7beeba1e36806209d4c6e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 30 Dec 2020 16:00:43 +0200 Subject: [PATCH 20/20] Improve FD bulk action description --- app/views/admin/base/_menu.haml | 2 +- app/views/admin/mass_actions/index.html.erb | 4 ++-- config/locales/admin/menu.en.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/base/_menu.haml b/app/views/admin/base/_menu.haml index 23014aafe..46910afa7 100644 --- a/app/views/admin/base/_menu.haml +++ b/app/views/admin/base/_menu.haml @@ -33,7 +33,7 @@ %li= link_to t('.blocked_domains'), admin_blocked_domains_path %li= link_to t('.reserved_domains'), admin_reserved_domains_path %li= link_to t('.disputed_domains'), admin_disputes_path - %li= link_to t('.mass_actions'), admin_mass_actions_path + %li= link_to t('.bulk_actions'), admin_mass_actions_path %li= link_to t('.bounced_email_addresses'), admin_bounced_mail_addresses_path %li= link_to t('.epp_log'), admin_epp_logs_path(created_after: 'today') %li= link_to t('.repp_log'), admin_repp_logs_path(created_after: 'today') diff --git a/app/views/admin/mass_actions/index.html.erb b/app/views/admin/mass_actions/index.html.erb index 6d6ee5eb4..22ddf6bbb 100644 --- a/app/views/admin/mass_actions/index.html.erb +++ b/app/views/admin/mass_actions/index.html.erb @@ -1,11 +1,11 @@
Bulk Domain Force Delete
-

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. Each domain entry must be on separate line. Line must include domain_name (puny) followed with delete_reason, separated by comma.

+

Triggers soft force delete procedure for uploaded domain list. List must be in CSV format. First row of the CSV file must contain column headings with domain_name for the first and delete_reason for the second column. Each domain entry must be on separate line. Domain names are expected to be in punycode format, valid reasons are listed below.

Allowed delete reasons: ENTITY_BURIED | INVALID_PHONE | INVALID_EMAIL

<%= form_tag admin_mass_actions_path, multipart: true, method: :post do %> <%= label_tag :entry_list %> diff --git a/config/locales/admin/menu.en.yml b/config/locales/admin/menu.en.yml index d67ed5831..52f0a210b 100644 --- a/config/locales/admin/menu.en.yml +++ b/config/locales/admin/menu.en.yml @@ -14,7 +14,7 @@ en: blocked_domains: Blocked domains reserved_domains: Reserved domains disputed_domains: Disputed domains - mass_actions: Mass actions + bulk_actions: Bulk actions bounced_email_addresses: Bounced emails epp_log: EPP log repp_log: REPP log