Merge pull request #1830 from internetee/1828-send-poll-message-to-registrant-on-applying-and-removing-registry-lock

Registry lock: Notify Registrar by EPP notification
This commit is contained in:
Timo Võhmar 2021-02-11 13:14:44 +02:00 committed by GitHub
commit a3cca9149b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 7 deletions

View file

@ -12,6 +12,7 @@ module Concerns
statuses << DomainStatus::SERVER_DELETE_PROHIBITED
statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
self.locked_by_registrant_at = Time.zone.now
alert_registrar_lock_changes!(lock: true)
save!
end
@ -42,10 +43,21 @@ module Concerns
statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
self.locked_by_registrant_at = nil
alert_registrar_lock_changes!(lock: false)
save!
end
end
def alert_registrar_lock_changes!(lock: true)
translation = lock ? 'locked' : 'unlocked'
registrar.notifications.create!(
text: I18n.t("notifications.texts.registrar_#{translation}",
domain_name: name),
attached_obj_id: name,
attached_obj_type: self.class.name
)
end
end
end
end

View file

@ -25,6 +25,10 @@ class Notification < ApplicationRecord
''
end
def registry_lock?
text.include?('has been locked') || text.include?('has been unlocked')
end
private
def set_defaults