Merge pull request #121 from internetee/110687814-update_values

110687814 update values
This commit is contained in:
Timo Võhmar 2016-04-11 12:14:43 +03:00
commit 8f1f31f8de
7 changed files with 32 additions and 2 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,5 @@
class AddUpIdValueToDomain < ActiveRecord::Migration
def change
add_column :domains, :upid, :integer
end
end

View file

@ -0,0 +1,5 @@
class AddUpIdValueToContact < ActiveRecord::Migration
def change
add_column :contacts, :upid, :integer
end
end

View file

@ -0,0 +1,5 @@
class AddUpDateValueToDomain < ActiveRecord::Migration
def change
add_column :domains, :up_date, :timestamp
end
end

View file

@ -0,0 +1,5 @@
class AddUpDateValueToContact < ActiveRecord::Migration
def change
add_column :contacts, :up_date, :timestamp
end
end