Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-06-18 21:26:13 +03:00
commit ce9585d582
7 changed files with 18 additions and 14 deletions

View file

@ -15,7 +15,7 @@ class Admin::CertificatesController < AdminController
crt = certificate_params[:crt].open.read if certificate_params[:crt]
csr = certificate_params[:csr].open.read if certificate_params[:csr]
@certificate = @api_user.certificates.build(csr: Certificate.sanitize(csr), crt: Certificate.sanitize(crt))
@certificate = @api_user.certificates.build(csr: csr, crt: crt)
if @api_user.save
flash[:notice] = I18n.t('record_created')
redirect_to [:admin, @api_user, @certificate]

View file

@ -6,6 +6,8 @@ class Registrar::InvoicesController < RegistrarController
def index
params[:q] ||= {}
invoices = current_user.registrar.invoices.includes(:invoice_items, :account_activity)
params[:q][:sum_cache_gteq].gsub!(',', '.')
params[:q][:sum_cache_lteq].gsub!(',', '.')
@q = invoices.search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@invoices = @q.result.page(params[:page])

View file

@ -132,11 +132,6 @@ class Certificate < ActiveRecord::Base
end
class << self
def sanitize(c)
return nil unless c
c.gsub("\r", '')
end
def update_crl
update_id_crl
update_registry_crl

View file

@ -51,9 +51,9 @@ class DomainTransfer < ActiveRecord::Base
end
end
def notify_losing_registrar
def notify_losing_registrar(contacts, registrant)
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_type: self.class.to_s
)

View file

@ -527,6 +527,9 @@ class Epp::Domain < Domain
def query_transfer(frame, current_user)
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
begin
dt = domain_transfers.create!(
@ -545,7 +548,7 @@ class Epp::Domain < Domain
if dt.approved?
transfer_contacts(current_user.registrar_id)
dt.notify_losing_registrar
dt.notify_losing_registrar(old_contact_codes, old_registrant_code)
generate_auth_info
self.registrar = current_user.registrar
end

View file

@ -525,7 +525,7 @@ en:
client_side_status_editing_error: 'Parameter value policy error. Client-side object status management not supported'
switch_to: Switch to
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
activemodel:

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
epp_plain_request(xml)
end
@ -755,8 +758,9 @@ describe 'EPP Domain', epp: true do
response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ')
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['count'].should == '1'