Add List-Unsubscribe email header (#26085)
This commit is contained in:
committed by
GitHub
parent
f2257069b2
commit
ca342d4838
@ -8,6 +8,7 @@ class NotificationMailer < ApplicationMailer
|
||||
before_action :process_params
|
||||
before_action :set_status, only: [:mention, :favourite, :reblog]
|
||||
before_action :set_account, only: [:follow, :favourite, :reblog, :follow_request]
|
||||
after_action :set_list_headers!
|
||||
|
||||
default to: -> { email_address_with_name(@user.email, @me.username) }
|
||||
|
||||
@ -61,6 +62,7 @@ class NotificationMailer < ApplicationMailer
|
||||
@me = params[:recipient]
|
||||
@user = @me.user
|
||||
@type = action_name
|
||||
@unsubscribe_url = unsubscribe_url(token: @user.to_sgid(for: 'unsubscribe').to_s, type: @type)
|
||||
end
|
||||
|
||||
def set_status
|
||||
@ -71,6 +73,12 @@ 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'
|
||||
end
|
||||
|
||||
def thread_by_conversation(conversation)
|
||||
return if conversation.nil?
|
||||
|
||||
|
Reference in New Issue
Block a user