refactoring

This commit is contained in:
Oleg Hasjanov 2021-04-07 15:38:14 +03:00
parent dad4790ccc
commit 9c0018d6fe
4 changed files with 6 additions and 8 deletions

View file

@ -54,8 +54,8 @@ module Admin
@domain.is_admin = true
@domain.admin_status_update dp[:statuses]
if @domain.update(dp)
@domain.admin_store_statuses_history = @domain.statuses
@domain.save
# @domain.admin_store_statuses_history = @domain.statuses
# @domain.save
flash[:notice] = I18n.t('domain_updated')
redirect_to [:admin, @domain]
else

View file

@ -55,6 +55,4 @@ module Domain::RegistryLockable
attached_obj_type: self.class.name
)
end
private
end

View file

@ -558,8 +558,8 @@ class Domain < ApplicationRecord
# special handling for admin changing status
def admin_status_update(update)
# check for deleted status
self.admin_store_statuses_history = statuses
update(admin_store_statuses_history: update)
statuses.each do |s|
unless update.include? s
case s

View file

@ -17,11 +17,11 @@ class RegistrantUser < User
Country.new(alpha2_code)
end
def companies(company_register = nil)
def companies(company_register = CompanyRegister::Client.new)
return [] if ident.include?('-')
[OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'),
OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')]
company_register.representation_rights(citizen_personal_code: ident,
citizen_country_code: country.alpha3)
end
def contacts(representable: true)