Show old contacts in transfer poll #2453

This commit is contained in:
Martin Lensment 2015-06-18 17:33:29 +03:00
parent b5167213d9
commit 67dfda9bc7
4 changed files with 15 additions and 8 deletions

View file

@ -51,9 +51,9 @@ class DomainTransfer < ActiveRecord::Base
end end
end end
def notify_losing_registrar def notify_losing_registrar(contacts, registrant)
transfer_from.messages.create!( transfer_from.messages.create!(
body: I18n.t('domain_transfer_was_approved', contacts: domain.contacts.pluck(:code).sort), body: I18n.t('domain_transfer_was_approved', contacts: contacts, registrant: registrant),
attached_obj_id: id, attached_obj_id: id,
attached_obj_type: self.class.to_s attached_obj_type: self.class.to_s
) )

View file

@ -369,7 +369,7 @@ class Epp::Domain < Domain
at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes] at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes]
at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes] at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes]
at[:dnskeys_attributes] += at_add[:dnskeys_attributes] at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
at[:statuses] = at[:statuses] =
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add') statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
# at[:statuses] += at_add[:domain_statuses_attributes] # at[:statuses] += at_add[:domain_statuses_attributes]
@ -527,6 +527,9 @@ class Epp::Domain < Domain
def query_transfer(frame, current_user) def query_transfer(frame, current_user)
return false unless can_be_transferred_to?(current_user.registrar) return false unless can_be_transferred_to?(current_user.registrar)
old_contact_codes = contacts.pluck(:code).sort.uniq
old_registrant_code = registrant.code
transaction do transaction do
begin begin
dt = domain_transfers.create!( dt = domain_transfers.create!(
@ -545,7 +548,7 @@ class Epp::Domain < Domain
if dt.approved? if dt.approved?
transfer_contacts(current_user.registrar_id) transfer_contacts(current_user.registrar_id)
dt.notify_losing_registrar dt.notify_losing_registrar(old_contact_codes, old_registrant_code)
generate_auth_info generate_auth_info
self.registrar = current_user.registrar self.registrar = current_user.registrar
end end

View file

@ -525,7 +525,7 @@ en:
client_side_status_editing_error: 'Parameter value policy error. Client-side object status management not supported' client_side_status_editing_error: 'Parameter value policy error. Client-side object status management not supported'
switch_to: Switch to switch_to: Switch to
admin_menu: Admin admin_menu: Admin
domain_transfer_was_approved: 'Domain transfer was approved, associated contacts are: %{contacts}' domain_transfer_was_approved: 'Domain transfer was approved, associated contacts were: %{contacts} and registrant was %{registrant}'
# DEPP # DEPP
activemodel: activemodel:
@ -830,4 +830,4 @@ en:
unset_force_delete: 'Unset force delete' unset_force_delete: 'Unset force delete'
domain_expiring: 'Domain expiring' domain_expiring: 'Domain expiring'
domain_validation_rules: 'Domain validation rules' domain_validation_rules: 'Domain validation rules'
bank_statement_desc: 'Import file row will match only when matching following attributes: <b>invoice nr, description, sum and client ref number</b>.' bank_statement_desc: 'Import file row will match only when matching following attributes: <b>invoice nr, description, sum and client ref number</b>.'

View file

@ -732,6 +732,9 @@ describe 'EPP Domain', epp: true do
] ]
}) })
old_contact_codes = domain.contacts.pluck(:code).sort.uniq
old_registrant_code = domain.registrant.code
response = login_as :registrar2 do response = login_as :registrar2 do
epp_plain_request(xml) epp_plain_request(xml)
end end
@ -755,8 +758,9 @@ describe 'EPP Domain', epp: true do
response[:msg].should == 'Command completed successfully; ack to dequeue' response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ') msg_q = response[:parsed].css('msgQ')
msg_q.css('qDate').text.should_not be_blank msg_q.css('qDate').text.should_not be_blank
contacts = domain.contacts.pluck(:code).sort
msg_q.css('msg').text.should == "Domain transfer was approved, associated contacts are: #{contacts}" msg_q.css('msg').text.should == "Domain transfer was approved, associated contacts were: " \
"#{old_contact_codes} and registrant was #{old_registrant_code}"
msg_q.first['id'].should_not be_blank msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '1' msg_q.first['count'].should == '1'