mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
fix: made admin status store, related to lock feature
This commit is contained in:
parent
3985513407
commit
dad4790ccc
8 changed files with 25 additions and 87 deletions
|
@ -1,9 +0,0 @@
|
|||
module Domain::RegistryLockable
|
||||
extend ActiveSupport::Concern
|
||||
class Base < ActiveInteraction::Base
|
||||
object :domain,
|
||||
class: Domain,
|
||||
description: 'Domain to set ForceDelete on'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
module Domain::RegistryLockable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
class SetRegistratLock < Base
|
||||
LOCK_STATUSES = [DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
||||
|
||||
def execute
|
||||
transaction do
|
||||
self.statuses |= LOCK_STATUSES
|
||||
self.locked_by_registrant_at = Time.zone.now
|
||||
alert_registrar_lock_changes!(lock: true)
|
||||
|
||||
save!
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue