diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index f4dc51fd9..117aaabc0 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -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) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 46690325f..52fef7143 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -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 diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index b3d374e6b..fff048666 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -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 diff --git a/db/migrate/20160225113801_add_up_id_value_to_domain.rb b/db/migrate/20160225113801_add_up_id_value_to_domain.rb new file mode 100644 index 000000000..9879c8555 --- /dev/null +++ b/db/migrate/20160225113801_add_up_id_value_to_domain.rb @@ -0,0 +1,5 @@ +class AddUpIdValueToDomain < ActiveRecord::Migration + def change + add_column :domains, :upid, :integer + end +end diff --git a/db/migrate/20160225113812_add_up_id_value_to_contact.rb b/db/migrate/20160225113812_add_up_id_value_to_contact.rb new file mode 100644 index 000000000..b78478e75 --- /dev/null +++ b/db/migrate/20160225113812_add_up_id_value_to_contact.rb @@ -0,0 +1,5 @@ +class AddUpIdValueToContact < ActiveRecord::Migration + def change + add_column :contacts, :upid, :integer + end +end diff --git a/db/migrate/20160226132045_add_up_date_value_to_domain.rb b/db/migrate/20160226132045_add_up_date_value_to_domain.rb new file mode 100644 index 000000000..5fdc3d196 --- /dev/null +++ b/db/migrate/20160226132045_add_up_date_value_to_domain.rb @@ -0,0 +1,5 @@ +class AddUpDateValueToDomain < ActiveRecord::Migration + def change + add_column :domains, :up_date, :timestamp + end +end diff --git a/db/migrate/20160226132056_add_up_date_value_to_contact.rb b/db/migrate/20160226132056_add_up_date_value_to_contact.rb new file mode 100644 index 000000000..f7ba92313 --- /dev/null +++ b/db/migrate/20160226132056_add_up_date_value_to_contact.rb @@ -0,0 +1,5 @@ +class AddUpDateValueToContact < ActiveRecord::Migration + def change + add_column :contacts, :up_date, :timestamp + end +end