th: TH_DROP_ALL_MAIL, TH_MAILER_SIDEKIQ_RETRY_LIMIT
th: TH_DROP_ADMIN_MAIL, TH_DROP_ALL_ADMIN_MAILmain
parent
d5d0beb3ce
commit
d9dbcf921f
|
@ -4,6 +4,7 @@
|
|||
|
||||
- quote posting
|
||||
- Treehouse::Automod (experimental feature flagged)
|
||||
- TH_MAILER_SIDEKIQ_RETRY_LIMIT=2
|
||||
|
||||
## Other Changes
|
||||
|
||||
|
|
|
@ -11,7 +11,11 @@ class AdminMailer < ApplicationMailer
|
|||
|
||||
default to: -> { @me.user_email }
|
||||
|
||||
self.delivery_job = Treehouse::DeliveryJob
|
||||
|
||||
def new_report(report)
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_admin_mail
|
||||
@report = report
|
||||
|
||||
locale_for_account(@me) do
|
||||
|
@ -20,6 +24,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def new_appeal(appeal)
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_admin_mail
|
||||
@appeal = appeal
|
||||
|
||||
locale_for_account(@me) do
|
||||
|
@ -28,6 +34,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def new_pending_account(user)
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_admin_mail
|
||||
@account = user.account
|
||||
|
||||
locale_for_account(@me) do
|
||||
|
@ -36,6 +44,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def new_trends(links, tags, statuses)
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_admin_mail
|
||||
@links = links
|
||||
@tags = tags
|
||||
@statuses = statuses
|
||||
|
@ -46,6 +56,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def new_software_updates
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_admin_mail
|
||||
@software_updates = SoftwareUpdate.all.to_a.sort_by(&:gem_version)
|
||||
|
||||
locale_for_account(@me) do
|
||||
|
@ -54,6 +66,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def new_critical_software_updates
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_all_admin_mail
|
||||
@software_updates = SoftwareUpdate.where(urgent: true).to_a.sort_by(&:gem_version)
|
||||
|
||||
headers['Priority'] = 'urgent'
|
||||
|
@ -66,6 +80,8 @@ class AdminMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def auto_close_registrations
|
||||
# HACK: remove this when mail works again
|
||||
return if Rails.configuration.x.th_drop_all_admin_mail
|
||||
locale_for_account(@me) do
|
||||
mail subject: default_i18n_subject(instance: @instance)
|
||||
end
|
||||
|
|
|
@ -14,6 +14,8 @@ class UserMailer < Devise::Mailer
|
|||
|
||||
default to: -> { @resource.email }
|
||||
|
||||
self.delivery_job = Treehouse::DeliveryJob
|
||||
|
||||
def confirmation_instructions(user, token, *, **)
|
||||
@resource = user
|
||||
@token = token
|
||||
|
|
|
@ -57,6 +57,7 @@ require_relative '../lib/arel/union_parenthesizing'
|
|||
require_relative '../lib/simple_navigation/item_extensions'
|
||||
|
||||
require_relative '../lib/treehouse/automod'
|
||||
require_relative '../lib/treehouse/delivery_job'
|
||||
|
||||
Dotenv::Railtie.load
|
||||
|
||||
|
@ -126,6 +127,15 @@ module Mastodon
|
|||
Devise::FailureApp.include Localized
|
||||
end
|
||||
|
||||
config.x.th_mailer_sidekiq_retry_limit = ENV.fetch('TH_MAILER_SIDEKIQ_RETRY_LIMIT', '2').to_i
|
||||
|
||||
config.x.th_drop_all_mail = !ENV.fetch('TH_DROP_ALL_MAIL', '').strip.empty?
|
||||
|
||||
config.action_mailer.perform_deliveries = !config.x.th_drop_all_mail
|
||||
|
||||
config.x.th_drop_all_admin_mail = !ENV.fetch('TH_DROP_ALL_ADMIN_MAIL', '').strip.empty? || config.x.th_drop_all_mail
|
||||
config.x.th_drop_admin_mail = !ENV.fetch('TH_DROP_ADMIN_MAIL', '').strip.empty? || config.x.th_drop_all_admin_mail
|
||||
|
||||
config.x.th_automod.automod_account_username = ENV['TH_STAFF_ACCOUNT']
|
||||
config.x.th_automod.account_service_heuristic_auto_suspend_active = ENV.fetch('TH_ACCOUNT_SERVICE_HEURISTIC_AUTO_SUSPEND', '') == 'that-one-spammer'
|
||||
config.x.th_automod.mention_spam_heuristic_auto_limit_active = ENV.fetch('TH_MENTION_SPAM_HEURISTIC_AUTO_LIMIT_ACTIVE', '') == 'can-spam'
|
||||
|
|
|
@ -68,3 +68,7 @@ SidekiqUniqueJobs.configure do |config|
|
|||
config.reaper_timeout = 150
|
||||
config.lock_ttl = 50.days.to_i
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:active_job) do
|
||||
include ::Sidekiq::Worker::Options unless respond_to?(:sidekiq_options)
|
||||
end
|
||||
|
|
|
@ -345,7 +345,7 @@ RSpec.describe User do
|
|||
user = Fabricate(:user)
|
||||
ActiveJob::Base.queue_adapter = :test
|
||||
|
||||
expect { user.send_confirmation_instructions }.to have_enqueued_job(ActionMailer::MailDeliveryJob)
|
||||
expect { user.send_confirmation_instructions }.to have_enqueued_job(Treehouse::DeliveryJob)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue