mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Send poll message to Registrar after it's contact has been archieved
This commit is contained in:
parent
fa6ebd9cda
commit
dadb8ba88a
2 changed files with 9 additions and 1 deletions
|
@ -17,16 +17,23 @@ module Concerns
|
||||||
inactive
|
inactive
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive(verified: false)
|
def archive(verified: false, notify: true)
|
||||||
unless verified
|
unless verified
|
||||||
raise 'Contact cannot be archived' unless archivable?(post: true)
|
raise 'Contact cannot be archived' unless archivable?(post: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
notify_registrar_about_archivation if notify
|
||||||
destroy!
|
destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def notify_registrar_about_archivation
|
||||||
|
registrar.notifications.create!(text: I18n.t('contact_has_been_archived',
|
||||||
|
contact_code: code,
|
||||||
|
orphan_months: Setting.orphans_contacts_in_months))
|
||||||
|
end
|
||||||
|
|
||||||
def inactive?
|
def inactive?
|
||||||
if DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
if DomainVersion.contact_unlinked_more_than?(contact_id: id, period: inactivity_period)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -643,6 +643,7 @@ en:
|
||||||
cant_match_version: 'Impossible match version with request'
|
cant_match_version: 'Impossible match version with request'
|
||||||
user_not_authenticated: "user not authenticated"
|
user_not_authenticated: "user not authenticated"
|
||||||
actions: Actions
|
actions: Actions
|
||||||
|
contact_has_been_archived: 'Contact with code %{contact_code} has been archieved because it has been orphaned for longer than %{orphan_months} months.'
|
||||||
|
|
||||||
number:
|
number:
|
||||||
currency:
|
currency:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue