mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Merge remote-tracking branch 'origin/master' into story/105855968-directo
# Conflicts: # Gemfile # Gemfile.lock
This commit is contained in:
commit
da7fed9577
232 changed files with 330 additions and 426083 deletions
|
@ -25,10 +25,11 @@ class Admin::AccountActivitiesController < AdminController
|
|||
@account_activities = @q.result.page(params[:page]).per(params[:results_per_page])
|
||||
sort = @account_activities.orders.map(&:to_sql).join(",")
|
||||
|
||||
# can do here inline SQL as it's our
|
||||
if params[:page] && params[:page].to_i > 1
|
||||
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value) + @b.result.where.not(id: @q.result.map(&:id))
|
||||
@sum = @q.result.reorder(sort).limit(@account_activities.offset_value).sum(:sum) + @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||
else
|
||||
@sum = @b.result.where.not(id: @q.result.map(&:id))
|
||||
@sum = @b.result.where("account_activities.id NOT IN (#{@q.result.select(:id).to_sql})").sum(:sum)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -20,6 +20,8 @@ class Admin::ContactsController < AdminController
|
|||
else
|
||||
contacts = Contact.includes(:registrar)
|
||||
end
|
||||
contacts = contacts.where("ident_country_code is null or ident_country_code=''") if params[:only_no_country_code].eql?('1')
|
||||
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.search(search_params)
|
||||
|
|
|
@ -1,8 +1,26 @@
|
|||
class Registrant::ContactsController < RegistrantController
|
||||
|
||||
helper_method :domain_ids
|
||||
def show
|
||||
@contact = Contact.find(params[:id])
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@current_user = current_user
|
||||
|
||||
authorize! :read, @contact
|
||||
@contact.valid?
|
||||
end
|
||||
|
||||
def contacts
|
||||
begin
|
||||
DomainContact.where(domain_id: domain_ids).pluck(:contact_id) | Domain.where(id: domain_ids).pluck(:registrant_id)
|
||||
rescue Soap::Arireg::NotAvailableError => error
|
||||
flash[:notice] = I18n.t(error.json[:message])
|
||||
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def domain_ids
|
||||
@domain_ids ||= begin
|
||||
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
|
||||
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,15 +11,28 @@ class Registrant::DomainsController < RegistrantController
|
|||
end
|
||||
|
||||
def show
|
||||
@domain = Domain.find(params[:id])
|
||||
if !(domains.include?(@domain) || @domain.valid?)
|
||||
redirect_to registrant_domains_path
|
||||
end
|
||||
@domain = domains.find(params[:id])
|
||||
authorize! :read, @domain
|
||||
end
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
@domain = domains.find(params[:id])
|
||||
end
|
||||
|
||||
def domain_verification_url
|
||||
authorize! :view, :registrant_domains
|
||||
dom = domains.find(params[:id])
|
||||
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
|
||||
dom.pending_json.present?
|
||||
|
||||
@domain = dom
|
||||
confirm_path = get_confirm_path(dom.statuses)
|
||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
else
|
||||
flash[:warning] = I18n.t('available_verification_url_not_found')
|
||||
redirect_to registrant_domain_path(dom.id)
|
||||
end
|
||||
end
|
||||
|
||||
def download_list
|
||||
|
@ -61,4 +74,13 @@ class Registrant::DomainsController < RegistrantController
|
|||
yield
|
||||
params[:q][:valid_to_lteq] = ca_cache
|
||||
end
|
||||
|
||||
def get_confirm_path(statuses)
|
||||
if statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||
"#{ENV['registrant_url']}/registrant/domain_update_confirms"
|
||||
elsif statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
"#{ENV['registrant_url']}/registrant/domain_delete_confirms"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
class Registrant::RegistrantsController < RegistrantController
|
||||
|
||||
def show
|
||||
@contact = Registrant.find(params[:id])
|
||||
authorize! :read, @contact
|
||||
@contact.valid?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue