diff --git a/app/models/instance.rb b/app/models/instance.rb index c01c23077ff6522f17e53930b4d4a2d6e1351dcd..36110ee4001f4f95d26d7e54a0498e08817a8e6d 100644 --- a/app/models/instance.rb +++ b/app/models/instance.rb @@ -32,8 +32,12 @@ class Instance < ApplicationRecord @delivery_failure_tracker ||= DeliveryFailureTracker.new(domain) end + def purgeable? + unavailable? || domain_block&.suspend? + end + def unavailable? - unavailable_domain.present? || domain_block&.suspend? + unavailable_domain.present? end def failing? diff --git a/app/views/admin/instances/show.html.haml b/app/views/admin/instances/show.html.haml index bed94f3feb4a8bc456d02e467a3304e9c8680a36..70912a4f5e0937935444265f5b066bdaa54af6cb 100644 --- a/app/views/admin/instances/show.html.haml +++ b/app/views/admin/instances/show.html.haml @@ -89,7 +89,7 @@ = 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? -- if @instance.unavailable? +- if @instance.purgeable? %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'