mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Merge branch '110687814-update_values' into staging
This commit is contained in:
commit
1e19855c9d
7 changed files with 28 additions and 3 deletions
|
@ -31,7 +31,7 @@ class Epp::ContactsController < EppController
|
||||||
def update
|
def update
|
||||||
authorize! :update, @contact, @password
|
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'
|
render_epp_response 'epp/contacts/update'
|
||||||
else
|
else
|
||||||
handle_errors(@contact)
|
handle_errors(@contact)
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Epp::Contact < Contact
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
# rubocop:disable Metrics/AbcSize
|
||||||
def update_attributes(frame)
|
def update_attributes(frame, current_user)
|
||||||
return super if frame.blank?
|
return super if frame.blank?
|
||||||
at = {}.with_indifferent_access
|
at = {}.with_indifferent_access
|
||||||
at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false))
|
at.deep_merge!(self.class.attrs_from(frame.css('chg'), new_record: false))
|
||||||
|
@ -181,6 +181,9 @@ class Epp::Contact < Contact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.upid = current_user.id if current_user
|
||||||
|
self.up_date = Time.zone.now
|
||||||
|
|
||||||
super(at)
|
super(at)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize
|
# rubocop:enable Metrics/AbcSize
|
||||||
|
|
|
@ -6,7 +6,6 @@ class Epp::Domain < Domain
|
||||||
attr_accessor :is_renewal, :is_transfer
|
attr_accessor :is_renewal, :is_transfer
|
||||||
|
|
||||||
before_validation :manage_permissions
|
before_validation :manage_permissions
|
||||||
|
|
||||||
def manage_permissions
|
def manage_permissions
|
||||||
return if is_admin # this bad hack for 109086524, refactor later
|
return if is_admin # this bad hack for 109086524, refactor later
|
||||||
return true if is_transfer || is_renewal
|
return true if is_transfer || is_renewal
|
||||||
|
@ -500,6 +499,9 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
# at[:statuses] += at_add[:domain_statuses_attributes]
|
# 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')
|
if registrant_id && registrant.code == frame.css('registrant')
|
||||||
|
|
||||||
throw :epp_error, {
|
throw :epp_error, {
|
||||||
|
|
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