Merge branch '1828-send-poll-message-to-registrant-on-applying-and-removing-registry-lock' of https://github.com/internetee/registry into 1828-send-poll-message-to-registrant-on-applying-and-removing-registry-lock

This commit is contained in:
Karl Erik Õunapuu 2021-02-09 16:32:20 +02:00
commit 3fcaaaee46
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 5 additions and 5 deletions

View file

@ -12,7 +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!
alert_registrar_lock_changes!(lock: true)
save!
end
@ -43,14 +43,14 @@ module Concerns
statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
self.locked_by_registrant_at = nil
alert_registrar_lock_changes!
alert_registrar_lock_changes!(lock: false)
save!
end
end
def alert_registrar_lock_changes!
translation = locked_by_registrant? ? 'locked' : 'unlocked'
def alert_registrar_lock_changes!(lock: true)
translation = lock ? 'locked' : 'unlocked'
registrar.notifications.create!(
text: I18n.t("notifications.texts.registrar_#{translation}",
domain_name: name),

View file

@ -22,7 +22,7 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
refute @domain.locked_by_registrant?
@domain.apply_registry_lock
assert @domain.locked_by_registrant?
assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant")
assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been locked by registrant")
end
def test_registrant_unlocked_domain