mirror of
https://github.com/internetee/registry.git
synced 2025-06-13 16:14:47 +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
|
@ -1,3 +1,11 @@
|
||||||
|
04.11.2020
|
||||||
|
* Email notification templates for forceDelete are now automatically selected according to registrant type [#442](https://github.com/internetee/registry/issues/442)
|
||||||
|
|
||||||
|
03.11.2020
|
||||||
|
* Fixed registrant confirmation while forcedelete is set on a domain [#1729](https://github.com/internetee/registry/issues/1729)
|
||||||
|
* Fixed search in registrar domain view [#262](https://github.com/internetee/registry/issues/262)
|
||||||
|
* Fixed double status issue on setting forceDelete [#1135](https://github.com/internetee/registry/issues/1135)
|
||||||
|
|
||||||
28.10.2020
|
28.10.2020
|
||||||
* Domain renew now canceles pending delete process [#1664](https://github.com/internetee/registry/issues/1664)
|
* Domain renew now canceles pending delete process [#1664](https://github.com/internetee/registry/issues/1664)
|
||||||
* Added multi-language support to whois disclaimer [#1703](https://github.com/internetee/registry/issues/1703)
|
* Added multi-language support to whois disclaimer [#1703](https://github.com/internetee/registry/issues/1703)
|
||||||
|
|
|
@ -22,7 +22,7 @@ module Admin
|
||||||
send_email
|
send_email
|
||||||
domain.update(contact_notification_sent_date: Time.zone.today)
|
domain.update(contact_notification_sent_date: Time.zone.today)
|
||||||
else
|
else
|
||||||
domain.update(template_name: params[:template_name])
|
domain.update(template_name: domain.notification_template)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ module Admin
|
||||||
DomainDeleteMailer.forced(domain: domain,
|
DomainDeleteMailer.forced(domain: domain,
|
||||||
registrar: domain.registrar,
|
registrar: domain.registrar,
|
||||||
registrant: domain.registrant,
|
registrant: domain.registrant,
|
||||||
template_name: params[:template_name]).deliver_now
|
template_name: domain.notification_template).deliver_now
|
||||||
end
|
end
|
||||||
|
|
||||||
def force_delete_type
|
def force_delete_type
|
||||||
|
|
|
@ -11,26 +11,27 @@ class Registrar
|
||||||
search_params[:name_matches].present?
|
search_params[:name_matches].present?
|
||||||
domain = Domain.find_by(name: search_params[:name_matches])
|
domain = Domain.find_by(name: search_params[:name_matches])
|
||||||
|
|
||||||
if domain
|
redirect_to info_registrar_domains_url(domain_name: domain.name) and return if domain
|
||||||
redirect_to info_registrar_domains_url(domain_name: domain.name) and return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:statuses_contains]
|
domains = if params[:statuses_contains]
|
||||||
domains = current_registrar_user.registrar.domains.includes(:registrar, :registrant).where(
|
current_domain_scope.where('domains.statuses @> ?::varchar[]',
|
||||||
"statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
"{#{params[:statuses_contains].join(',')}}")
|
||||||
)
|
else
|
||||||
else
|
current_domain_scope
|
||||||
domains = current_registrar_user.registrar.domains.includes(:registrar, :registrant)
|
end
|
||||||
|
|
||||||
|
if params[:contacts_ident_eq]
|
||||||
|
domains = domains.where(contacts: { ident: params[:contacts_ident_eq] })
|
||||||
end
|
end
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
@q = domains.search(search_params)
|
@q = domains.search(search_params.except(:contacts_ident_eq))
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
|
|
||||||
# if we do not get any results, add wildcards to the name field and search again
|
# if we do not get any results, add wildcards to the name field and search again
|
||||||
if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/
|
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]}%"
|
new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%"
|
||||||
@q = domains.search(new_search_params)
|
@q = domains.search(new_search_params)
|
||||||
@domains = @q.result.page(params[:page])
|
@domains = @q.result.page(params[:page])
|
||||||
|
@ -56,6 +57,10 @@ class Registrar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_domain_scope
|
||||||
|
current_registrar_user.registrar.domains.includes(:registrar, :registrant)
|
||||||
|
end
|
||||||
|
|
||||||
def info
|
def info
|
||||||
authorize! :info, Depp::Domain
|
authorize! :info, Depp::Domain
|
||||||
@data = @domain.info(params[:domain_name]) if params[:domain_name]
|
@data = @domain.info(params[:domain_name]) if params[:domain_name]
|
||||||
|
|
|
@ -19,6 +19,10 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def notification_template
|
||||||
|
registrant.org? ? 'legal_person' : 'private_person'
|
||||||
|
end
|
||||||
|
|
||||||
def force_delete_scheduled?
|
def force_delete_scheduled?
|
||||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||||
end
|
end
|
||||||
|
@ -129,9 +133,9 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_force_delete_statuses
|
def add_force_delete_statuses
|
||||||
statuses << DomainStatus::FORCE_DELETE
|
self.statuses |= [DomainStatus::FORCE_DELETE,
|
||||||
statuses << DomainStatus::SERVER_RENEW_PROHIBITED
|
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||||
statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
|
DomainStatus::SERVER_TRANSFER_PROHIBITED]
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_force_delete_statuses
|
def remove_force_delete_statuses
|
||||||
|
|
|
@ -384,7 +384,7 @@ class Domain < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrant_update_confirmable?(token)
|
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 pending_update?
|
||||||
return false unless registrant_verification_asked?
|
return false unless registrant_verification_asked?
|
||||||
return false unless registrant_verification_token == token
|
return false unless registrant_verification_token == token
|
||||||
|
|
|
@ -33,12 +33,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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 %>
|
<% end %>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -32,4 +32,4 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= 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="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label :contact_ident, for: nil %>
|
<%= 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,19 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
|
||||||
assert_not @domain.force_delete_scheduled?
|
assert_not @domain.force_delete_scheduled?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_force_delete_does_not_double_statuses
|
||||||
|
statuses = [
|
||||||
|
DomainStatus::FORCE_DELETE,
|
||||||
|
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||||
|
DomainStatus::SERVER_TRANSFER_PROHIBITED,
|
||||||
|
]
|
||||||
|
@domain.statuses = @domain.statuses + statuses
|
||||||
|
@domain.save!
|
||||||
|
@domain.reload
|
||||||
|
@domain.schedule_force_delete(type: :fast_track)
|
||||||
|
assert_equal @domain.statuses.size, statuses.size
|
||||||
|
end
|
||||||
|
|
||||||
def test_cancelling_force_delete_removes_statuses_that_were_set_on_force_delete
|
def test_cancelling_force_delete_removes_statuses_that_were_set_on_force_delete
|
||||||
statuses = [
|
statuses = [
|
||||||
DomainStatus::FORCE_DELETE,
|
DomainStatus::FORCE_DELETE,
|
||||||
|
@ -252,4 +265,16 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
|
||||||
assert @domain.force_delete_scheduled?
|
assert @domain.force_delete_scheduled?
|
||||||
assert @domain.pending_update?
|
assert @domain.pending_update?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_force_delete_does_not_affect_registrant_update_confirmable
|
||||||
|
@domain.schedule_force_delete(type: :soft)
|
||||||
|
@domain.registrant_verification_asked!('test', User.last.id)
|
||||||
|
@domain.save!
|
||||||
|
@domain.reload
|
||||||
|
|
||||||
|
@domain.statuses << DomainStatus::PENDING_UPDATE
|
||||||
|
|
||||||
|
assert @domain.force_delete_scheduled?
|
||||||
|
assert @domain.registrant_update_confirmable?(@domain.registrant_verification_token)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,6 +42,22 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
find(:css, '#soft_delete').set(true)
|
find(:css, '#soft_delete').set(true)
|
||||||
click_link_or_button 'Force delete domain'
|
click_link_or_button 'Force delete domain'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@domain.reload
|
||||||
|
assert_equal template_name, @domain.template_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_uses_legal_template_if_registrant_org
|
||||||
|
@domain.registrant.update(ident_type: 'org')
|
||||||
|
|
||||||
|
assert_emails 0 do
|
||||||
|
visit edit_admin_domain_url(@domain)
|
||||||
|
find(:css, '#soft_delete').set(true)
|
||||||
|
click_link_or_button 'Force delete domain'
|
||||||
|
end
|
||||||
|
|
||||||
|
@domain.reload
|
||||||
|
assert_equal template_name, @domain.template_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
||||||
|
@ -71,4 +87,10 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
assert_no_button 'Schedule force delete'
|
assert_no_button 'Schedule force delete'
|
||||||
assert_no_link 'Schedule force delete'
|
assert_no_link 'Schedule force delete'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def template_name
|
||||||
|
@domain.registrant.org? ? 'legal_person' : 'private_person'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue