Fix nil error when viewing suspended domain in admin UI (#17765)

th-downstream
Eugen Rochko 3 years ago committed by GitHub
parent bcd34b4b17
commit bf39f3a038

@ -32,8 +32,12 @@ class Instance < ApplicationRecord
@delivery_failure_tracker ||= DeliveryFailureTracker.new(domain) @delivery_failure_tracker ||= DeliveryFailureTracker.new(domain)
end end
def purgeable?
unavailable? || domain_block&.suspend?
end
def unavailable? def unavailable?
unavailable_domain.present? || domain_block&.suspend? unavailable_domain.present?
end end
def failing? def failing?

@ -89,7 +89,7 @@
= t('admin.instances.availability.failures_recorded', count: @instance.delivery_failure_tracker.days) = t('admin.instances.availability.failures_recorded', count: @instance.delivery_failure_tracker.days)
= link_to t('admin.instances.delivery.clear'), clear_delivery_errors_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post } unless @instance.exhausted_deliveries_days.empty? = link_to t('admin.instances.delivery.clear'), clear_delivery_errors_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post } unless @instance.exhausted_deliveries_days.empty?
- if @instance.unavailable? - if @instance.purgeable?
%p= t('admin.instances.purge_description_html') %p= t('admin.instances.purge_description_html')
= link_to t('admin.instances.purge'), admin_instance_path(@instance), data: { confirm: t('admin.instances.confirm_purge'), method: :delete }, class: 'button button--destructive' = link_to t('admin.instances.purge'), admin_instance_path(@instance), data: { confirm: t('admin.instances.confirm_purge'), method: :delete }, class: 'button button--destructive'

Loading…
Cancel
Save