Rename Message to Notification

This commit is contained in:
Artur Beljajev 2018-08-23 20:03:03 +03:00
parent 5ba2170324
commit 8765baf319
32 changed files with 243 additions and 229 deletions

View file

@ -79,8 +79,8 @@ class ApiUser < User
username
end
def queued_messages
registrar.messages.queued
def queued_notifications
registrar.notifications.queued
end
def registrar_pki_ok?(crt, cn)

View file

@ -270,8 +270,8 @@ class Domain < ActiveRecord::Base
true
end
def poll_message!(message_key)
registrar.messages.create!(
def notify_registrar(message_key)
registrar.notifications.create!(
body: "#{I18n.t(message_key)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class.to_s

View file

@ -73,8 +73,8 @@ class DomainTransfer < ActiveRecord::Base
old_contacts_codes = domain.contacts.pluck(:code).sort.uniq.join(', ')
old_registrant_code = domain.registrant.code
old_registrar.messages.create!(
body: I18n.t('messages.texts.domain_transfer',
old_registrar.notifications.create!(
body: I18n.t('notifications.texts.domain_transfer',
domain_name: domain.name,
old_contacts_codes: old_contacts_codes,
old_registrant_code: old_registrant_code),

View file

@ -625,7 +625,7 @@ class Epp::Domain < Domain
)
if dt.pending?
registrar.messages.create!(
registrar.notifications.create!(
body: I18n.t('transfer_requested'),
attached_obj_id: dt.id,
attached_obj_type: dt.class.to_s
@ -727,7 +727,7 @@ class Epp::Domain < Domain
return false unless valid?
registrar.messages.create!(
registrar.notifications.create!(
body: 'Key Relay action completed successfully.',
attached_obj_type: kr.class.to_s,
attached_obj_id: kr.id

View file

@ -1,5 +1,5 @@
class Message < ActiveRecord::Base
include Versions # version/message_version.rb
class Notification < ActiveRecord::Base
include Versions # version/notification_version.rb
belongs_to :registrar, required: true
before_create -> { self.queued = true }

View file

@ -4,7 +4,7 @@ class Registrar < ActiveRecord::Base
has_many :domains, dependent: :restrict_with_error
has_many :contacts, dependent: :restrict_with_error
has_many :api_users, dependent: :restrict_with_error
has_many :messages
has_many :notifications
has_many :invoices, foreign_key: 'buyer_id'
has_many :accounts, dependent: :destroy
has_many :nameservers, through: :domains

View file

@ -1,5 +0,0 @@
class MessageVersion < PaperTrail::Version
include VersionSession
self.table_name = :log_messages
self.sequence_name = :log_messages_id_seq
end

View file

@ -0,0 +1,5 @@
class NotificationVersion < PaperTrail::Version
include VersionSession
self.table_name = :log_notifications
self.sequence_name = :log_notifications_id_seq
end