From c1bba784d6450948c4f809bf805051b749372de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 28 Oct 2020 16:35:35 +0200 Subject: [PATCH 01/12] 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 7b258f8e798ada9d681177ba6e0d1c9e60abbae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 28 Oct 2020 17:05:48 +0200 Subject: [PATCH 02/12] Don't force RegistrantUser name to be uppercase --- app/models/registrant_user.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 40f48f69c..cb8212e17 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -57,7 +57,9 @@ class RegistrantUser < User def update_related_contacts cc, idcode = registrant_ident.split('-') - contacts = Contact.where(ident: idcode, country_code: cc).where('name != ?', username) + contacts = Contact.where(ident: idcode, country_code: cc) + .where('UPPER(name) != UPPER(?)', username) + contacts.each { |c| c.update(name: username) } end @@ -67,8 +69,8 @@ class RegistrantUser < User return false unless user_data[:first_name] return false unless user_data[:last_name] - user_data.each_value { |v| v.upcase! if v.is_a?(String) } user_data[:country_code] ||= 'EE' + %i[ident country_code].each { |f| user_data[f].upcase! if user_data[f].is_a?(String) } find_or_create_by_user_data(user_data) end From e1d2fb45d57be67ae924cf47767cc31b253d7624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 29 Oct 2020 11:11:39 +0200 Subject: [PATCH 03/12] Fix tests --- app/models/registrant_user.rb | 5 ++-- .../registrant_user_creation_test.rb | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index cb8212e17..420446582 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) @@ -56,8 +55,7 @@ class RegistrantUser < User end def update_related_contacts - cc, idcode = registrant_ident.split('-') - contacts = Contact.where(ident: idcode, country_code: cc) + contacts = Contact.where(ident: ident, country_code: country_code) .where('UPPER(name) != UPPER(?)', username) contacts.each { |c| c.update(name: username) } @@ -100,6 +98,7 @@ class RegistrantUser < User user.username = "#{user_data[:first_name]} #{user_data[:last_name]}" user.save + user.update_related_contacts user end end diff --git a/test/models/registrant_user/registrant_user_creation_test.rb b/test/models/registrant_user/registrant_user_creation_test.rb index 5ed680795..9fff4ca02 100644 --- a/test/models/registrant_user/registrant_user_creation_test.rb +++ b/test/models/registrant_user/registrant_user_creation_test.rb @@ -14,7 +14,7 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase assert_equal('JOHN SMITH', user.username) end - def test_find_or_create_by_api_data_creates_a_user_after_upcasing_input + def test_find_or_create_by_api_data_creates_a_user_with_original_name user_data = { ident: '37710100070', first_name: 'John', @@ -24,6 +24,25 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase RegistrantUser.find_or_create_by_api_data(user_data) user = User.find_by(registrant_ident: 'EE-37710100070') - assert_equal('JOHN SMITH', user.username) + assert_equal('John Smith', user.username) + end + + def test_updates_related_contacts_name_if_differs_from_e_identity + contact = contacts(:john) + contact.update(ident: '39708290276', ident_country_code: 'EE') + + user_data = { + ident: '39708290276', + first_name: 'John', + last_name: 'Doe' + } + + RegistrantUser.find_or_create_by_api_data(user_data) + + user = User.find_by(registrant_ident: 'EE-39708290276') + assert_equal('John Doe', user.username) + + contact.reload + assert_equal user.username, contact.name end end From 2f259982da9e1d22a80305c37e80fd529bf59ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 30 Oct 2020 11:51:20 +0200 Subject: [PATCH 04/12] Find related contacts via ident and ident_country_code --- app/models/registrant_user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 420446582..f1e0e1c2d 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -55,7 +55,8 @@ class RegistrantUser < User end def update_related_contacts - contacts = Contact.where(ident: ident, country_code: country_code) + cc, idcode = registrant_ident.split('-') + contacts = Contact.where(ident: idcode, ident_country_code: cc) .where('UPPER(name) != UPPER(?)', username) contacts.each { |c| c.update(name: username) } From 89154c4fe200482caa1f868802b8bdf642b13cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 30 Oct 2020 11:56:07 +0200 Subject: [PATCH 05/12] Use predefined methods to determine country and ident --- app/models/registrant_user.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index f1e0e1c2d..089292917 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -55,8 +55,7 @@ class RegistrantUser < User end def update_related_contacts - cc, idcode = registrant_ident.split('-') - contacts = Contact.where(ident: idcode, ident_country_code: cc) + contacts = Contact.where(ident: ident, ident_country_code: country.alpha2) .where('UPPER(name) != UPPER(?)', username) contacts.each { |c| c.update(name: username) } From 3444c4e021e007ad75e384f64cb5c0922ec39cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 3 Nov 2020 16:14:01 +0200 Subject: [PATCH 06/12] Add registrar poll message after updateing registrant contact(s) names --- app/models/registrant_user.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 089292917..aa41ccff8 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -58,7 +58,11 @@ class RegistrantUser < User contacts = Contact.where(ident: ident, ident_country_code: country.alpha2) .where('UPPER(name) != UPPER(?)', username) - contacts.each { |c| c.update(name: username) } + contacts.each do |contact| + contact.update(name: username) + action = actions.create!(contact: contact, operation: :update) + contact.registrar.notify(action) + end end class << self From 20d5ab9ebf1fe4fca67531e02fe46e82444af04c Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 4 Nov 2020 14:24:09 +0500 Subject: [PATCH 07/12] Fix statuses processing for ForceDelete --- app/models/concerns/domain/force_delete.rb | 4 +-- test/models/domain/force_delete_test.rb | 33 ++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 7a1ace6a7..7f3cb3922 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -80,8 +80,8 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end def cancel_force_delete - restore_statuses_before_force_delete remove_force_delete_statuses + restore_statuses_before_force_delete clear_force_delete_data self.force_delete_date = nil self.force_delete_start = nil @@ -119,7 +119,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength end def preserve_current_statuses_for_force_delete - self.statuses_before_force_delete = statuses.clone + update(statuses_before_force_delete: statuses) end def restore_statuses_before_force_delete diff --git a/test/models/domain/force_delete_test.rb b/test/models/domain/force_delete_test.rb index 8fcbfeb2b..f0723c326 100644 --- a/test/models/domain/force_delete_test.rb +++ b/test/models/domain/force_delete_test.rb @@ -150,19 +150,36 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase assert_equal @domain.statuses.size, statuses.size end - def test_cancelling_force_delete_removes_statuses_that_were_set_on_force_delete - statuses = [ - DomainStatus::FORCE_DELETE, - DomainStatus::SERVER_RENEW_PROHIBITED, - DomainStatus::SERVER_TRANSFER_PROHIBITED, - ] - @domain.statuses = @domain.statuses + statuses + def test_cancelling_force_delete_removes_force_delete_status @domain.schedule_force_delete(type: :fast_track) + assert @domain.statuses.include?(DomainStatus::FORCE_DELETE) + assert @domain.statuses.include?(DomainStatus::SERVER_RENEW_PROHIBITED) + assert @domain.statuses.include?(DomainStatus::SERVER_TRANSFER_PROHIBITED) + @domain.cancel_force_delete @domain.reload - assert_empty @domain.statuses & statuses + assert_not @domain.statuses.include?(DomainStatus::FORCE_DELETE) + assert_not @domain.statuses.include?(DomainStatus::SERVER_RENEW_PROHIBITED) + assert_not @domain.statuses.include?(DomainStatus::SERVER_TRANSFER_PROHIBITED) + end + + def test_cancelling_force_delete_keeps_previous_statuses + statuses = [ + DomainStatus::SERVER_RENEW_PROHIBITED, + DomainStatus::SERVER_TRANSFER_PROHIBITED, + ] + + @domain.statuses = statuses + @domain.save! + @domain.reload + + @domain.schedule_force_delete(type: :fast_track) + @domain.cancel_force_delete + @domain.reload + + assert_equal @domain.statuses, statuses end def test_hard_force_delete_should_have_outzone_and_purge_date_with_time From c3f63ed43a80a60410e52e4e29d53af89c136008 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 30 Oct 2020 15:36:34 +0500 Subject: [PATCH 08/12] Add new mailer template for expired soft delete domains --- app/jobs/domain_expire_email_job.rb | 6 ++- app/mailers/domain_expire_mailer.rb | 37 ++++++++++---- .../expired_soft.html.erb | 48 +++++++++++++++++++ .../expired_soft.text.erb | 48 +++++++++++++++++++ test/mailers/domain_expire_mailer_test.rb | 11 ++++- .../previews/domain_expire_mailer_preview.rb | 8 +++- 6 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 app/views/mailers/domain_expire_mailer/expired_soft.html.erb create mode 100644 app/views/mailers/domain_expire_mailer/expired_soft.text.erb diff --git a/app/jobs/domain_expire_email_job.rb b/app/jobs/domain_expire_email_job.rb index 9b70a54e6..94bd8670c 100644 --- a/app/jobs/domain_expire_email_job.rb +++ b/app/jobs/domain_expire_email_job.rb @@ -4,6 +4,10 @@ class DomainExpireEmailJob < Que::Job return if domain.registered? - DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now + if domain.force_delete_scheduled? + DomainExpireMailer.expired_soft(domain: domain, registrar: domain.registrar).deliver_now + else + DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now + end end end diff --git a/app/mailers/domain_expire_mailer.rb b/app/mailers/domain_expire_mailer.rb index ecbd8ee3d..e73b1fa84 100644 --- a/app/mailers/domain_expire_mailer.rb +++ b/app/mailers/domain_expire_mailer.rb @@ -1,19 +1,38 @@ class DomainExpireMailer < ApplicationMailer + attr_accessor :domain, :registrar + def expired(domain:, registrar:) - @domain = domain_presenter(domain: domain) - @registrar = registrar_presenter(registrar: registrar) + process_mail(domain: domain, registrar: registrar, method_name: __method__.to_s) + end - recipient = filter_invalid_emails(emails: domain.primary_contact_emails, domain: domain) - subject = default_i18n_subject(domain_name: domain.name) - - logger.info("Send DomainExpireMailer#expired email for domain #{domain.name} (##{domain.id})" \ - " to #{recipient.join(', ')}") - - mail(to: recipient, subject: subject) + def expired_soft(domain:, registrar:) + process_mail(domain: domain, registrar: registrar, method_name: __method__.to_s) end private + def process_mail(domain:, registrar:, method_name:) + init(domain, registrar) + + logger.info("Send DomainExpireMailer##{method_name} email for #{domain.name} (##{domain.id})" \ + " to #{recipient(domain).join(', ')}") + + mail(to: recipient(domain), subject: subject) + end + + def init(domain, registrar) + @domain = domain_presenter(domain: domain) + @registrar = registrar_presenter(registrar: registrar) + end + + def recipient(domain) + filter_invalid_emails(emails: domain.primary_contact_emails, domain: @domain) + end + + def subject + default_i18n_subject(domain_name: @domain.name) + end + def domain_presenter(domain:) DomainPresenter.new(domain: domain, view: view_context) end diff --git a/app/views/mailers/domain_expire_mailer/expired_soft.html.erb b/app/views/mailers/domain_expire_mailer/expired_soft.html.erb new file mode 100644 index 000000000..1dd661a38 --- /dev/null +++ b/app/views/mailers/domain_expire_mailer/expired_soft.html.erb @@ -0,0 +1,48 @@ +

Domeen <%= @domain.name %> on aegunud ning suunatud kustutusmenetlusse kuna oleme tuvastanud domeeniga seotud kontaktides olulisi puudusi.

+ +

Lugupeetud .ee domeeni registreerija/halduskontakt

+ +

Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav. Domeeniga on seotud puudulike kontakti objekte, milles tulenevalt on Eesti Interneti SA blokeerinud domeeni pikendamise ja registripidaja vahetuse, kuniks kontaktandmed korrastatakse. Andmete korrastamiseks ja registreeringu pikendamiseks pöörduge palun oma registripidaja poole.

+ +

<%= @domain.name %> pikendamata jätmisel domeen kustub ja läheb <%= @domain.delete_date %> oksjonile .ee oksjonikeskkonda. Domeenioksjonite kohta loe lähemalt siit.

+ +

Domeeni <%= @domain.name %> registripidaja:

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

Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist.

+ +<%= render 'mailers/shared/signatures/signature.et.html' %> + +
+ +

Domain <%= @domain.name %> has expired

+ +

Dear registrant/administrative contact of .ee domain,

+ +

The domain name <%= @domain.name %> has expired and since <%= @domain.on_hold_date %> is no longer available on the Internet. Domain registration has invalid contact data. Renewal and registrar transfer is therefore prohibited until contact data has been fixed. To correct the data and renew your domain registration, please contact your registrar.

+ +

If you do not renew the <%= @domain.name %> domain registration, it is deleted and put on auction to .ee domain auction environment at <%= @domain.delete_date %>. Read more about .ee domain auctions here.

+ +

Registrar of the <%= @domain.name %>:

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

You can find an overview of all your domains at the registrant's portal.

+ +<%= render 'mailers/shared/signatures/signature.en.html' %> + +
+ +

Срок действия домена <%= @domain.name %> истек

+ +

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

+ +

Срок действия доменного имени <%= @domain.name %> истек, и с <%= @domain.on_hold_date %> оно больше не доступно в интернете. У домена указаны неверные контактные данные. Обновление и перенос к другому регистратору заблокированы до исправления контактных данных. Для исправления контактных данных и обновления регистрации вашего домена, пожалуйста, обратитесь в вашему регистратору.

+ +

Если доменное имя не продлено, домен <%= @domain.name %> будет удален и <%= @domain.delete_date %> идет на аукцион в .ee среду аукциона. О проведении доменных аукционов читайте здесь.

+ +

Pегистратор домена <%= @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_expire_mailer/expired_soft.text.erb b/app/views/mailers/domain_expire_mailer/expired_soft.text.erb new file mode 100644 index 000000000..0e6d9c953 --- /dev/null +++ b/app/views/mailers/domain_expire_mailer/expired_soft.text.erb @@ -0,0 +1,48 @@ +Domeen <%= @domain.name %> on aegunud ning suunatud kustutusmenetlusse kuna oleme tuvastanud domeeniga seotud kontaktides olulisi puudusi. + +Lugupeetud .ee domeeni registreerija/halduskontakt + +Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav. Domeeniga on seotud puudulike kontakti objekte, milles tulenevalt on Eesti Interneti SA blokeerinud domeeni pikendamise ja registripidaja vahetuse, kuniks kontaktandmed korrastatakse. Andmete korrastamiseks ja registreeringu pikendamiseks pöörduge palun oma registripidaja poole. + +<%= @domain.name %> pikendamata jätmisel domeen kustub ja läheb <%= @domain.delete_date %> oksjonile .ee oksjonikeskkonda. Domeenioksjonite kohta loe lähemalt siit https://www.internet.ee/domeenioksjonid. + +Domeeni <%= @domain.name %> registripidaja: +<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %> + +Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist https://registrant.internet.ee/registrant/. + +<%= render 'mailers/shared/signatures/signature.et.html' %> + +-------------------------------------- + +Domain <%= @domain.name %> has expired + +Dear registrant/administrative contact of .ee domain, + +The domain name <%= @domain.name %> has expired and since <%= @domain.on_hold_date %> is no longer available on the Internet. Domain registration has invalid contact data. Renewal and registrar transfer is therefore prohibited until contact data has been fixed. To correct the data and renew your domain registration, please contact your registrar. + +If you do not renew the <%= @domain.name %> domain registration, it is deleted and put on auction to .ee domain auction environment at <%= @domain.delete_date %>. Read more about .ee domain auctions here https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment. + +Registrar of the <%= @domain.name %>: +<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %> + +You can find an overview of all your domains at the registrant's portal https://registrant.internet.ee/registrant/. + +<%= render 'mailers/shared/signatures/signature.en.html' %> + +-------------------------------------- + +Срок действия домена <%= @domain.name %> истек + +Уважаемый регистрант/административный контакт домена .ee + +Срок действия доменного имени <%= @domain.name %> истек, и с <%= @domain.on_hold_date %> оно больше не доступно в интернете. У домена указаны неверные контактные данные. Обновление и перенос к другому регистратору заблокированы до исправления контактных данных. Для исправления контактных данных и обновления регистрации вашего домена, пожалуйста, обратитесь в вашему регистратору. + +Если доменное имя не продлено, домен <%= @domain.name %> будет удален и <%= @domain.delete_date %> идет на аукцион в .ee среду аукциона. О проведении доменных аукционов читайте здесь https://www.internet.ee/domeny/dogovor-pol-zovatelya-aukcionnoj-sredy#3-usloviya-uchastiya-v-aukcione. + +Pегистратор домена <%= @domain.name %>: +<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %> + +Обзор всех связанных с вами доменов можете получить на портале регистратора https://registrant.internet.ee/registrant/. + +<%= render 'mailers/shared/signatures/signature.ru.html' %> diff --git a/test/mailers/domain_expire_mailer_test.rb b/test/mailers/domain_expire_mailer_test.rb index 1502bf2f6..9209652fd 100644 --- a/test/mailers/domain_expire_mailer_test.rb +++ b/test/mailers/domain_expire_mailer_test.rb @@ -11,4 +11,13 @@ class DomainExpireMailerTest < ActionMailer::TestCase assert_equal 'Domeen shop.test on aegunud / Domain shop.test has expired' \ ' / Срок действия домена shop.test истек', email.subject end -end \ No newline at end of file + + def test_delivers_domain_expiration_soft_email + domain = domains(:shop) + assert_equal 'shop.test', domain.name + + DomainExpireMailer.expired_soft(domain: domain, registrar: domain.registrar).deliver_now + + assert_emails 1 + end +end diff --git a/test/mailers/previews/domain_expire_mailer_preview.rb b/test/mailers/previews/domain_expire_mailer_preview.rb index bec206c0f..4d66d2fad 100644 --- a/test/mailers/previews/domain_expire_mailer_preview.rb +++ b/test/mailers/previews/domain_expire_mailer_preview.rb @@ -4,4 +4,10 @@ class DomainExpireMailerPreview < ActionMailer::Preview DomainExpireMailer.expired(domain: domain, registrar: domain.registrar) end -end \ No newline at end of file + + def expired_soft + domain = Domain.first + DomainExpireMailer.expired_soft(domain: domain, + registrar: domain.registrar) + end +end From 344da76dc64904ea103bf99966e5fdaa0381cffd Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 5 Nov 2020 11:22:25 +0500 Subject: [PATCH 09/12] Fix email subject --- app/mailers/domain_expire_mailer.rb | 6 +++--- config/locales/mailers/domain_expire.en.yml | 7 ++++++- test/mailers/domain_expire_mailer_test.rb | 8 +++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/mailers/domain_expire_mailer.rb b/app/mailers/domain_expire_mailer.rb index e73b1fa84..229120825 100644 --- a/app/mailers/domain_expire_mailer.rb +++ b/app/mailers/domain_expire_mailer.rb @@ -17,7 +17,7 @@ class DomainExpireMailer < ApplicationMailer logger.info("Send DomainExpireMailer##{method_name} email for #{domain.name} (##{domain.id})" \ " to #{recipient(domain).join(', ')}") - mail(to: recipient(domain), subject: subject) + mail(to: recipient(domain), subject: subject(method_name)) end def init(domain, registrar) @@ -29,8 +29,8 @@ class DomainExpireMailer < ApplicationMailer filter_invalid_emails(emails: domain.primary_contact_emails, domain: @domain) end - def subject - default_i18n_subject(domain_name: @domain.name) + def subject(method_name) + I18n.t("domain_expire_mailer.#{method_name}.subject", domain_name: @domain.name) end def domain_presenter(domain:) diff --git a/config/locales/mailers/domain_expire.en.yml b/config/locales/mailers/domain_expire.en.yml index 9a83a7a32..36353a44e 100644 --- a/config/locales/mailers/domain_expire.en.yml +++ b/config/locales/mailers/domain_expire.en.yml @@ -4,4 +4,9 @@ en: subject: >- Domeen %{domain_name} on aegunud / Domain %{domain_name} has expired - / Срок действия домена %{domain_name} истек \ No newline at end of file + / Срок действия домена %{domain_name} истек + expired_soft: + subject: >- + Domeen %{domain_name} on aegunud ning suunatud kustutusmenetlusse + / Domain %{domain_name} has expired and directed into deletion process + / Срок действия домена %{domain_name} истек diff --git a/test/mailers/domain_expire_mailer_test.rb b/test/mailers/domain_expire_mailer_test.rb index 9209652fd..84e520b78 100644 --- a/test/mailers/domain_expire_mailer_test.rb +++ b/test/mailers/domain_expire_mailer_test.rb @@ -8,16 +8,18 @@ class DomainExpireMailerTest < ActionMailer::TestCase email = DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now assert_emails 1 - assert_equal 'Domeen shop.test on aegunud / Domain shop.test has expired' \ - ' / Срок действия домена shop.test истек', email.subject + assert_equal I18n.t("domain_expire_mailer.expired.subject", domain_name: domain.name), + email.subject end def test_delivers_domain_expiration_soft_email domain = domains(:shop) assert_equal 'shop.test', domain.name - DomainExpireMailer.expired_soft(domain: domain, registrar: domain.registrar).deliver_now + email = DomainExpireMailer.expired_soft(domain: domain, registrar: domain.registrar).deliver_now assert_emails 1 + assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name), + email.subject end end From 28bede030cd5c255f01789355304b1c439e61d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 5 Nov 2020 12:13:18 +0200 Subject: [PATCH 10/12] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6721791d2..f7156ef51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +05.11.2020 +* New email template for expired domains in forceDelete [#1725](https://github.com/internetee/registry/issues/1725) + 04.11.2020 * Email notification templates for forceDelete are now automatically selected according to registrant type [#442](https://github.com/internetee/registry/issues/442) From 9a491924f8a0a5f19a7c87726c8552446651ad83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 5 Nov 2020 12:51:51 +0200 Subject: [PATCH 11/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7156ef51..ee8bea7bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ 05.11.2020 * New email template for expired domains in forceDelete [#1725](https://github.com/internetee/registry/issues/1725) +* Cancelling forceDelete (FD) restores the state of the domain prior application of FD [#1136](https://github.com/internetee/registry/issues/1136) 04.11.2020 * Email notification templates for forceDelete are now automatically selected according to registrant type [#442](https://github.com/internetee/registry/issues/442) From ed7181e0608aeafc600361b343f896c4e101c946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 5 Nov 2020 14:54:54 +0200 Subject: [PATCH 12/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8bea7bf..3dd2483f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ 05.11.2020 +* Registrant API contact name update feature [#1724](https://github.com/internetee/registry/issues/1724) * New email template for expired domains in forceDelete [#1725](https://github.com/internetee/registry/issues/1725) * Cancelling forceDelete (FD) restores the state of the domain prior application of FD [#1136](https://github.com/internetee/registry/issues/1136)