Merge branch '110687814-update_values' into staging

This commit is contained in:
Stas 2016-03-02 19:25:28 +02:00
commit 1e19855c9d
7 changed files with 28 additions and 3 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

@ -140,7 +140,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))
@ -181,6 +181,9 @@ class Epp::Contact < Contact
end
end
self.upid = current_user.id if current_user
self.up_date = Time.zone.now
super(at)
end
# rubocop:enable Metrics/AbcSize

View file

@ -6,7 +6,6 @@ class Epp::Domain < Domain
attr_accessor :is_renewal, :is_transfer
before_validation :manage_permissions
def manage_permissions
return if is_admin # this bad hack for 109086524, refactor later
return true if is_transfer || is_renewal
@ -500,6 +499,9 @@ class Epp::Domain < Domain
# at[:statuses] += at_add[:domain_statuses_attributes]
self.upid = current_user.id if current_user
self.up_date = Time.zone.now
if registrant_id && registrant.code == frame.css('registrant')
throw :epp_error, {

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