mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Merge remote-tracking branch 'origin/master' into 1177-bulk-force-delete
This commit is contained in:
commit
1217ed633f
10 changed files with 84 additions and 25 deletions
|
@ -22,7 +22,7 @@ module Admin
|
|||
send_email
|
||||
domain.update(contact_notification_sent_date: Time.zone.today)
|
||||
else
|
||||
domain.update(template_name: params[:template_name])
|
||||
domain.update(template_name: domain.notification_template)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,7 +46,7 @@ module Admin
|
|||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant,
|
||||
template_name: params[:template_name]).deliver_now
|
||||
template_name: domain.notification_template).deliver_now
|
||||
end
|
||||
|
||||
def force_delete_type
|
||||
|
|
|
@ -11,26 +11,27 @@ class Registrar
|
|||
search_params[:name_matches].present?
|
||||
domain = Domain.find_by(name: search_params[:name_matches])
|
||||
|
||||
if domain
|
||||
redirect_to info_registrar_domains_url(domain_name: domain.name) and return
|
||||
end
|
||||
redirect_to info_registrar_domains_url(domain_name: domain.name) and return if domain
|
||||
end
|
||||
|
||||
if params[:statuses_contains]
|
||||
domains = current_registrar_user.registrar.domains.includes(:registrar, :registrant).where(
|
||||
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
||||
)
|
||||
else
|
||||
domains = current_registrar_user.registrar.domains.includes(:registrar, :registrant)
|
||||
domains = if params[:statuses_contains]
|
||||
current_domain_scope.where('domains.statuses @> ?::varchar[]',
|
||||
"{#{params[:statuses_contains].join(',')}}")
|
||||
else
|
||||
current_domain_scope
|
||||
end
|
||||
|
||||
if params[:contacts_ident_eq]
|
||||
domains = domains.where(contacts: { ident: params[:contacts_ident_eq] })
|
||||
end
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = domains.search(search_params)
|
||||
@q = domains.search(search_params.except(:contacts_ident_eq))
|
||||
@domains = @q.result.page(params[:page])
|
||||
|
||||
# if we do not get any results, add wildcards to the name field and search again
|
||||
if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/
|
||||
new_search_params = search_params.to_h
|
||||
new_search_params = search_params.to_h.except(:contacts_ident_eq)
|
||||
new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%"
|
||||
@q = domains.search(new_search_params)
|
||||
@domains = @q.result.page(params[:page])
|
||||
|
@ -56,6 +57,10 @@ class Registrar
|
|||
end
|
||||
end
|
||||
|
||||
def current_domain_scope
|
||||
current_registrar_user.registrar.domains.includes(:registrar, :registrant)
|
||||
end
|
||||
|
||||
def info
|
||||
authorize! :info, Depp::Domain
|
||||
@data = @domain.info(params[:domain_name]) if params[:domain_name]
|
||||
|
|
|
@ -19,6 +19,10 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
|||
end
|
||||
end
|
||||
|
||||
def notification_template
|
||||
registrant.org? ? 'legal_person' : 'private_person'
|
||||
end
|
||||
|
||||
def force_delete_scheduled?
|
||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
@ -129,9 +133,9 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
|||
end
|
||||
|
||||
def add_force_delete_statuses
|
||||
statuses << DomainStatus::FORCE_DELETE
|
||||
statuses << DomainStatus::SERVER_RENEW_PROHIBITED
|
||||
statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
|
||||
self.statuses |= [DomainStatus::FORCE_DELETE,
|
||||
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED]
|
||||
end
|
||||
|
||||
def remove_force_delete_statuses
|
||||
|
|
|
@ -384,7 +384,7 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def registrant_update_confirmable?(token)
|
||||
return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any?
|
||||
return false if statuses.include? DomainStatus::DELETE_CANDIDATE
|
||||
return false unless pending_update?
|
||||
return false unless registrant_verification_asked?
|
||||
return false unless registrant_verification_token == token
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group email-template-row">
|
||||
<label class="col-md-3 control-label"><%= t '.email_template' %></label>
|
||||
<div class="col-md-9">
|
||||
<%= select_tag 'template_name', options_for_select(templates), class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -32,4 +32,4 @@
|
|||
</div>
|
||||
|
||||
<%= render 'form' %>
|
||||
<%= render 'force_delete_dialog', domain: @domain, templates: force_delete_templates %>
|
||||
<%= render 'force_delete_dialog', domain: @domain %>
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label :contact_ident, for: nil %>
|
||||
<%= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident) %>
|
||||
<%= f.search_field :contacts_ident_eq, value: search_params[:contacts_ident_eq],
|
||||
class: 'form-control', placeholder: t(:contact_ident) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue