Suppression list improvements (#867)

This commit is contained in:
Will Power
2019-11-22 17:28:11 +00:00
committed by Adam Cooke
parent 10f4808fbf
commit dcb2919cc6
5 changed files with 9 additions and 2 deletions
@@ -23,6 +23,7 @@
.suppressionList__right { .suppressionList__right {
flex: 0 0 auto; flex: 0 0 auto;
text-align: right;
} }
.suppressionList__timestamp { .suppressionList__timestamp {
+5 -1
View File
@@ -14,7 +14,7 @@
- else - else
%p.pageContent__intro.u-margin %p.pageContent__intro.u-margin
When messages cannot be delivered, addresses are added to the suppression list which stops When messages cannot be delivered, addresses are added to the suppression list which stops
future messages to the same recipient being sent through. Recipients are removed from the list after 30 days. future messages to the same recipient being sent through. Recipients are removed from the list after #{Postal.config.general.suppression_list_removal_delay} days.
%ul.suppressionList %ul.suppressionList
- for suppression in @suppressions[:records] - for suppression in @suppressions[:records]
%li.suppressionList__item %li.suppressionList__item
@@ -23,4 +23,8 @@
%p.suppressionList__reason= suppression['reason'].capitalize %p.suppressionList__reason= suppression['reason'].capitalize
.suppressionList__right .suppressionList__right
%p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_s(:long)} %p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_s(:long)}
%p.suppressionList__timestamp
Expires #{Time.zone.at(suppression['keep_until']).to_s(:long)}
- if suppression['keep_until'] > Time.now.to_f
%span.u-red expired
= render 'shared/message_db_pagination', :data => @suppressions, :name => "suppression" = render 'shared/message_db_pagination', :data => @suppressions, :name => "suppression"
+1
View File
@@ -26,6 +26,7 @@ module Clockwork
every 1.day, 'every-day', :at => ['03:00'] do every 1.day, 'every-day', :at => ['03:00'] do
ProcessMessageRetentionJob.queue(:main) ProcessMessageRetentionJob.queue(:main)
PruneSuppressionListsJob.queue(:main)
end end
end end
+1
View File
@@ -13,6 +13,7 @@ general:
exception_url: exception_url:
maximum_delivery_attempts: 18 maximum_delivery_attempts: 18
maximum_hold_expiry_days: 7 maximum_hold_expiry_days: 7
suppression_list_removal_delay: 30
use_local_ns_for_domains: false use_local_ns_for_domains: false
web_server: web_server:
+1 -1
View File
@@ -7,7 +7,7 @@ module Postal
end end
def add(type, address, options = {}) def add(type, address, options = {})
keep_until = (options[:days] || 30).days.from_now.to_f keep_until = (options[:days] || Postal.config.general.suppression_list_removal_delay).days.from_now.to_f
if existing = @database.select('suppressions', :where => {:type => type, :address => address}, :limit =>1).first if existing = @database.select('suppressions', :where => {:type => type, :address => address}, :limit =>1).first
reason = options[:reason] || existing['reason'] reason = options[:reason] || existing['reason']
@database.update('suppressions', {:reason => reason, :keep_until => keep_until}, :where => {:id => existing['id']}) @database.update('suppressions', {:reason => reason, :keep_until => keep_until}, :where => {:id => existing['id']})