Merge remote-tracking branch 'parent/main' into upstream-20240926
This commit is contained in:
commit
c905714459
517 changed files with 4284 additions and 3891 deletions
|
@ -9,6 +9,8 @@ class AdminMailer < ApplicationMailer
|
|||
before_action :process_params
|
||||
before_action :set_instance
|
||||
|
||||
after_action :set_important_headers!, only: :new_critical_software_updates
|
||||
|
||||
default to: -> { @me.user_email }
|
||||
|
||||
def new_report(report)
|
||||
|
@ -64,10 +66,6 @@ class AdminMailer < ApplicationMailer
|
|||
def new_critical_software_updates
|
||||
@software_updates = SoftwareUpdate.where(urgent: true).to_a.sort_by(&:gem_version)
|
||||
|
||||
headers['Priority'] = 'urgent'
|
||||
headers['X-Priority'] = '1'
|
||||
headers['Importance'] = 'high'
|
||||
|
||||
locale_for_account(@me) do
|
||||
mail subject: default_i18n_subject(instance: @instance)
|
||||
end
|
||||
|
@ -88,4 +86,12 @@ class AdminMailer < ApplicationMailer
|
|||
def set_instance
|
||||
@instance = Rails.configuration.x.local_domain
|
||||
end
|
||||
|
||||
def set_important_headers!
|
||||
headers(
|
||||
'Importance' => 'high',
|
||||
'Priority' => 'urgent',
|
||||
'X-Priority' => '1'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,8 +16,10 @@ class ApplicationMailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
def set_autoreply_headers!
|
||||
headers['Precedence'] = 'list'
|
||||
headers['X-Auto-Response-Suppress'] = 'All'
|
||||
headers['Auto-Submitted'] = 'auto-generated'
|
||||
headers(
|
||||
'Auto-Submitted' => 'auto-generated',
|
||||
'Precedence' => 'list',
|
||||
'X-Auto-Response-Suppress' => 'All'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,52 +6,50 @@ class NotificationMailer < ApplicationMailer
|
|||
:routing
|
||||
|
||||
before_action :process_params
|
||||
before_action :set_status, only: [:mention, :favourite, :reblog]
|
||||
with_options only: %i(mention favourite reblog) do
|
||||
before_action :set_status
|
||||
after_action :thread_by_conversation!
|
||||
end
|
||||
before_action :set_account, only: [:follow, :favourite, :reblog, :follow_request]
|
||||
after_action :set_list_headers!
|
||||
|
||||
before_deliver :verify_functional_user
|
||||
|
||||
default to: -> { email_address_with_name(@user.email, @me.username) }
|
||||
|
||||
layout 'mailer'
|
||||
|
||||
def mention
|
||||
return unless @user.functional? && @status.present?
|
||||
return if @status.blank?
|
||||
|
||||
locale_for_account(@me) do
|
||||
thread_by_conversation(@status.conversation)
|
||||
mail subject: default_i18n_subject(name: @status.account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def follow
|
||||
return unless @user.functional?
|
||||
|
||||
locale_for_account(@me) do
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def favourite
|
||||
return unless @user.functional? && @status.present?
|
||||
return if @status.blank?
|
||||
|
||||
locale_for_account(@me) do
|
||||
thread_by_conversation(@status.conversation)
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def reblog
|
||||
return unless @user.functional? && @status.present?
|
||||
return if @status.blank?
|
||||
|
||||
locale_for_account(@me) do
|
||||
thread_by_conversation(@status.conversation)
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def follow_request
|
||||
return unless @user.functional?
|
||||
|
||||
locale_for_account(@me) do
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
|
@ -75,18 +73,26 @@ class NotificationMailer < ApplicationMailer
|
|||
@account = @notification.from_account
|
||||
end
|
||||
|
||||
def set_list_headers!
|
||||
headers['List-ID'] = "<#{@type}.#{@me.username}.#{Rails.configuration.x.local_domain}>"
|
||||
headers['List-Unsubscribe'] = "<#{@unsubscribe_url}>"
|
||||
headers['List-Unsubscribe-Post'] = 'List-Unsubscribe=One-Click'
|
||||
def verify_functional_user
|
||||
throw(:abort) unless @user.functional?
|
||||
end
|
||||
|
||||
def thread_by_conversation(conversation)
|
||||
return if conversation.nil?
|
||||
def set_list_headers!
|
||||
headers(
|
||||
'List-ID' => "<#{@type}.#{@me.username}.#{Rails.configuration.x.local_domain}>",
|
||||
'List-Unsubscribe-Post' => 'List-Unsubscribe=One-Click',
|
||||
'List-Unsubscribe' => "<#{@unsubscribe_url}>"
|
||||
)
|
||||
end
|
||||
|
||||
msg_id = "<conversation-#{conversation.id}.#{conversation.created_at.strftime('%Y-%m-%d')}@#{Rails.configuration.x.local_domain}>"
|
||||
def thread_by_conversation!
|
||||
return if @status.conversation.nil?
|
||||
|
||||
headers['In-Reply-To'] = msg_id
|
||||
headers['References'] = msg_id
|
||||
conversation_message_id = "<conversation-#{@status.conversation.id}.#{@status.conversation.created_at.to_date}@#{Rails.configuration.x.local_domain}>"
|
||||
|
||||
headers(
|
||||
'In-Reply-To' => conversation_message_id,
|
||||
'References' => conversation_message_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue