From 3e8eeb4bb5680b44ea9f1a1d8f3cbd65bc506baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 10 Jun 2020 15:05:03 +0300 Subject: [PATCH] Fix locale attribute name for csync --- app/models/csync_record.rb | 16 ++++++++-------- config/locales/mailers/csync.en.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/csync_record.rb b/app/models/csync_record.rb index 1bf1737741..ced89fd25e 100644 --- a/app/models/csync_record.rb +++ b/app/models/csync_record.rb @@ -21,13 +21,7 @@ def record_new_scan(result) def compose_record_meta(result) result[:last_scan] = Time.zone.now result[:times_scanned] = persisted? && cdnskey != result[:cdnskey] ? 1 : times_scanned + 1 - result[:action] = if result[:type] == :secure - 'rollover' - elsif result[:type] == :insecure - 'initialize' - elsif result[:cdnskey] == '0 3 0 0' - 'deactivate' - end + result[:action] = determine_csync_intention(result[:type], result[:cdnskey]) result.except(:type, :ns, :ns_ip) end @@ -72,7 +66,7 @@ def notify_registrar_about_csync registrar = domain.registrar registrar.notifications.create!( text: I18n.t('notifications.texts.csync', - domain_name: domain.name, + domain: domain.name, action: action) ) end @@ -93,4 +87,10 @@ def self.clear(domain_name) domains = Domain.where(name: domain_name).all CsyncRecord.where(domain: domains).delete_all end + + def determine_csync_intention(type, cdnskey) + return 'rollover' if type == 'secure' && cdnskey != '0 3 0 0' + return 'initialized' if type == 'insecure' + return 'deactivate' if cdnskey == '0 3 0 0' + end end diff --git a/config/locales/mailers/csync.en.yml b/config/locales/mailers/csync.en.yml index 24578a9e94..06f0516891 100644 --- a/config/locales/mailers/csync.en.yml +++ b/config/locales/mailers/csync.en.yml @@ -4,7 +4,7 @@ en: subject: >- Teie domeeni %{domain_name} DNSSEC andmed on uuendatud / DNSSEC data for %{domain_name} has been updated - dnssec_updated: + dnssec_deleted: subject: >- Teie domeeni %{domain_name} DNSSEC andmed on eemaldatud / DNSSEC data for %{domain_name} has been removed