mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 18:53:26 +02:00
Merge pull request #121 from internetee/110687814-update_values
110687814 update values
This commit is contained in:
commit
8f1f31f8de
7 changed files with 32 additions and 2 deletions
|
@ -31,7 +31,7 @@ class Epp::ContactsController < EppController
|
|||
def update
|
||||
authorize! :update, @contact, @password
|
||||
|
||||
if @contact.update_attributes(params[:parsed_frame])
|
||||
if @contact.update_attributes(params[:parsed_frame], current_user)
|
||||
render_epp_response 'epp/contacts/update'
|
||||
else
|
||||
handle_errors(@contact)
|
||||
|
|
|
@ -141,7 +141,7 @@ class Epp::Contact < Contact
|
|||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def update_attributes(frame)
|
||||
def update_attributes(frame, current_user)
|
||||
return super if frame.blank?
|
||||
at = {}.with_indifferent_access
|
||||
at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false))
|
||||
|
@ -184,6 +184,9 @@ class Epp::Contact < Contact
|
|||
end
|
||||
end
|
||||
|
||||
self.upid = current_user.registrar.id if current_user.registrar
|
||||
self.up_date = Time.zone.now
|
||||
|
||||
super(at)
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
|
|
@ -504,6 +504,11 @@ class Epp::Domain < Domain
|
|||
|
||||
# at[:statuses] += at_add[:domain_statuses_attributes]
|
||||
|
||||
if errors.empty? && verify
|
||||
self.upid = current_user.registrar.id if current_user.registrar
|
||||
self.up_date = Time.zone.now
|
||||
end
|
||||
|
||||
if registrant_id && registrant.code == frame.css('registrant')
|
||||
|
||||
throw :epp_error, {
|
||||
|
@ -533,6 +538,8 @@ class Epp::Domain < Domain
|
|||
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
self.statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
self.upid = user.registrar.id if user.registrar
|
||||
self.up_date = Time.zone.now
|
||||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||
|
||||
send_mail :registrant_updated_notification_for_old_registrant
|
||||
|
|
5
db/migrate/20160225113801_add_up_id_value_to_domain.rb
Normal file
5
db/migrate/20160225113801_add_up_id_value_to_domain.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddUpIdValueToDomain < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domains, :upid, :integer
|
||||
end
|
||||
end
|
5
db/migrate/20160225113812_add_up_id_value_to_contact.rb
Normal file
5
db/migrate/20160225113812_add_up_id_value_to_contact.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddUpIdValueToContact < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :contacts, :upid, :integer
|
||||
end
|
||||
end
|
5
db/migrate/20160226132045_add_up_date_value_to_domain.rb
Normal file
5
db/migrate/20160226132045_add_up_date_value_to_domain.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddUpDateValueToDomain < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domains, :up_date, :timestamp
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddUpDateValueToContact < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :contacts, :up_date, :timestamp
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue