Merge remote-tracking branch 'origin/master' into 1763-registrar-bulk-renew

This commit is contained in:
Karl Erik Õunapuu 2020-12-21 14:36:49 +02:00
commit 00a65b3b01
No known key found for this signature in database
GPG key ID: C9DD647298A34764
40 changed files with 818 additions and 160 deletions

View file

@ -109,6 +109,7 @@ class Ability
can :destroy, :pending
can :create, :zonefile
can :access, :settings_menu
can :manage, BouncedMailAddress
end
def static_registrant

View file

@ -0,0 +1,28 @@
class BouncedMailAddress < ApplicationRecord
validates :email, :message_id, :bounce_type, :bounce_subtype, :action, :status, presence: true
def bounce_reason
"#{action} (#{status} #{diagnostic})"
end
def self.record(json)
bounced_records = json['bounce']['bouncedRecipients']
bounced_records.each do |record|
bounce_record = BouncedMailAddress.new(params_from_json(json, record))
bounce_record.save
end
end
def self.params_from_json(json, bounced_record)
{
email: bounced_record['emailAddress'],
message_id: json['mail']['messageId'],
bounce_type: json['bounce']['bounceType'],
bounce_subtype: json['bounce']['bounceSubType'],
action: bounced_record['action'],
status: bounced_record['status'],
diagnostic: bounced_record['diagnosticCode'],
}
end
end

View file

@ -347,19 +347,24 @@ class Contact < ApplicationRecord
@desc = {}
registrant_domains.each do |dom|
@desc[dom.name] ||= []
@desc[dom.name] << :registrant
@desc[dom.name] ||= { id: dom.uuid, roles: [] }
@desc[dom.name][:roles] << :registrant
end
domain_contacts.each do |dc|
@desc[dc.domain.name] ||= []
@desc[dc.domain.name] << dc.name.downcase.to_sym
@desc[dc.domain.name] ||= { id: dc.domain.uuid, roles: [] }
@desc[dc.domain.name][:roles] << dc.name.downcase.to_sym
@desc[dc.domain.name] = @desc[dc.domain.name].compact
end
@desc
end
def related_domains
a = related_domain_descriptions
a.keys.map { |d| { name: d, id: a[d][:id], roles: a[d][:roles] } }
end
def status_notes_array=(notes)
self.status_notes = {}
notes ||= []

View file

@ -421,7 +421,7 @@ class Domain < ApplicationRecord
pending_delete_confirmation!
save(validate: false) # should check if this did succeed
Domains::DeleteConfirm::SendRequest.run(domain: self)
Domains::DeleteConfirmEmail::SendRequest.run(domain: self)
end
def cancel_pending_delete

View file

@ -30,12 +30,12 @@ class RegistrantVerification < ApplicationRecord
def domain_registrant_delete_confirm!(initiator)
self.action_type = DOMAIN_DELETE
self.action = CONFIRMED
DomainDeleteConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
DomainDeleteConfirmJob.perform_later domain.id, CONFIRMED, initiator if save
end
def domain_registrant_delete_reject!(initiator)
self.action_type = DOMAIN_DELETE
self.action = REJECTED
DomainDeleteConfirmJob.enqueue domain.id, REJECTED, initiator if save
DomainDeleteConfirmJob.perform_later domain.id, REJECTED, initiator if save
end
end